//============================================================================================
/**
 * @file	zkn2_seq.c
 * @brief	金銀図鑑画面 メインシーケンス処理
 * @author	Hiroyuki Nakamura
 * @date	08.08.26
 */
//============================================================================================
#include "common.h"

#include "gflib/touchpanel.h"
#include "system/wipe.h"
#include "system/fontproc.h"
#include "system/snd_play.h"
#include "system/snd_perap.h"
#include "poketool/poke_number.h"

#include "zkn2_main.h"
#include "zkn2_seq.h"
#include "zkn2_bmp.h"
#include "zkn2_obj.h"
#include "zkn2_ui.h"
#include "zkn2_list.h"

#include "zukan_gra.naix"

#include "application/app_tool.h"


//============================================================================================
//	定数定義
//============================================================================================
#define	COVER_MOVE_SCROLL_SPEED	( 16 )	// カバーＢＧスクロール速度
#define	COVER_OUT_SCROLL_CNT	( 256 )	// カバースクロールアウト終了Ｘ座標
#define	COVER_IN_SCROLL_CNT		( 0 )	// カバースクロールイン終了Ｘ座標
#define	COVER_SCROLL_OPEN_POINT		( 64 )	// カバー開チェックスクロールポイント
#define	COVER_SCROLL_CLOSE_POINT	( 192 )	// カバー閉チェックスクロールポイント
// カバースオープン時にボタンインするタイミング
#define	COVER_OUT_BTNIN_SCRX	( COVER_MOVE_SCROLL_SPEED * 12 )
// カバースクローズ時にボタンインするタイミング
#define	COVER_IN_BTNIN_SCRX		( COVER_OUT_SCROLL_CNT - COVER_MOVE_SCROLL_SPEED * 12 )

#define	LIST_ZUKAN_END_FADE_START_CNT	( 10 )	// リストから図鑑終了のときのフェード開始カウント

#define	SWITCH_AREA_LX		( 96 )		// モード切替スイッチ判定エリア左Ｘ座標
#define	SWITCH_AREA_RX		( 160 )		// モード切替スイッチ判定エリア右Ｘ座標
#define	SWITCH_AREA_UY		( 120 )		// モード切替スイッチ判定エリア上Ｙ座標
#define	SWITCH_AREA_DY		( 136 )		// モード切替スイッチ判定エリア下Ｙ座標
#define	SWITCH_AREA_PRM_X	( 4 )		// モード切替スイッチ判定エリアＸ補正値
#define	SWITCH_AREA_PRM_Y	( 8 )		// モード切替スイッチ判定エリアＹ補正値

#define	LIST_SCROLL_SPD			( 1 )						// リストスクロール速度
#define	LIST_SCROLL_MAX			( 15 / LIST_SCROLL_SPD )	// リストスクロール最大値
#define	LIST_SCROLL_OBJ_SPD		( LIST_SCROLL_SPD * 8 )		// リストスクロールＯＢＪ速度

// シーケンスワーク：ボタンアニメ
typedef struct {
	u8	px;
	u8	py;
	u8	sx;
	u8	sy;

	u8	frm;
	u8	seq;
	u8	cnt;
	u8	n_pal:4;
	u8	p_pal:4;
}BUTTON_ANM_WORK;

// シーケンスワーク：カバー動作
typedef struct {
	u16	seq;
	u8	cnt;
	u8	flg;
}COVER_MOVE_WORK;

// シーケンスワーク：カバータッチ
typedef struct {
	u32	x;
	u32	y;
	s16	obj_def_x;
	u16	seq;
}COVER_TOUCH_WORK;

// シーケンスワーク：リストスクロール
typedef struct {
	u16 * scrn;
	u8	seq;
	u8	cnt;
	u8	bar_my;
	u8	key;
}LIST_SCROLL_WORK;

// シーケンスワーク：リストスクロール（レール）
typedef struct {
	u16	x;
	u16	y;
}LISTRAIL_SCROLL_WORK;

// シーケンスワーク：検索開始
typedef struct {
	u16	seq;
	u16	cnt;
}SEARCH_START_WORK;

// シーケンスワーク：詳細・リストスクロール
typedef struct {
	u8	seq;
	u8	cnt;
	u8	mv;
	u8	bar_my;
}DETAIL_LIST_SCROLL_WORK;

// シーケンスワーク：詳細画面終了
typedef struct {
	u16	seq;
	u8	start;
	u8	dmy;
}DETAIL_END_WORK;

// 詳細画面ページ
enum {
	DETAIL_PAGE_ENCOUNT = 0,	// 分布
	DETAIL_PAGE_SIZE,			// 大きさ
	DETAIL_PAGE_FORM,			// 姿
};

// 検索アニメウェイト
#define	SEARCH_ERROR_WAIT		( 60 )
#define	SEARCH_START_YADON_WAIT	( 32 )

// 検索開始シーケンス
enum {
	SEARCH_START_SEQ_GAGE_ANM = 0,		// ゲージアニメ開始
	SEARCH_START_SEQ_LIST_MAKE,			// リスト作成
	SEARCH_START_SEQ_BGWF_MAKE1,		// BGWF作成１
	SEARCH_START_SEQ_BGWF_MAKE2,		// BGWF作成２
	SEARCH_START_SEQ_BGWF_MAKE3,		// BGWF作成３
	SEARCH_START_SEQ_BGWF_MAKE4,		// BGWF作成４
	SEARCH_START_SEQ_BMPWIN_SET,		// BMPWINに書き込み
	SEARCH_START_SEQ_POKEICON_SET,		// ポケアイコンセット
	SEARCH_START_SEQ_OBJ_SET,			// その他OBJセット
	SEARCH_START_SEQ_YADON_ANM,			// ヤドンアニメ開始
	SEARCH_START_SEQ_BGWF_SET,			// BGWF移動
	SEARCH_START_SEQ_BGWF_WAIT,			// BGWF移動待ち
	SEARCH_START_SEQ_BTN_IN,			// ボタンイン
	SEARCH_START_SEQ_BTN_IN_WAIT,		// ボタンイン待ち
	SEARCH_START_SEQ_POKESELECT,		// ポケモン選択へ

	SEARCH_START_SEQ_ERR_YADON_START,	// エラー用ヤドンアニメ開始
	SEARCH_START_SEQ_ERR_YADON_WAIT,	// エラー用ヤドンアニメ終了待ち
	SEARCH_START_SEQ_ERROR_WAIT,		// エラー終了待ち
	SEARCH_START_SEQ_RETURN,			// 検索入力へ
};

// 検索入力画面遷移ワーク
typedef struct {
	u8	init;
	u8	next;
	u8	seq;
	u8	pos;
}SEARCH_INPUT_INIT_WORK;

// 検索ボタン座標
#define	SEARCHINPUT_BUTTON_ENTER_PX		( 0 )
#define	SEARCHINPUT_BUTTON_CANCEL_PX	( 22 )
#define	SEARCHINPUT_BUTTON_SX			( 10 )

// 高さ/重さカーソル動作ワーク
typedef struct {
	u32	tmp;
	u32	rep_cnt;
	u16	obj;
	s16	mv;
}SEARCH_HEIGHTWEIGHT_WORK;

// 高さ/重さカーソル動作カウント
#define	SEARCH_HEIGHTWEIGHT_REPCNT1		( 8 )
#define	SEARCH_HEIGHTWEIGHT_REPCNT2		( 16 )
#define	SEARCH_HEIGHTWEIGHT_REPCNT3		( 24 )
#define	SEARCH_HEIGHTWEIGHT_REPCNT_MAX	( SEARCH_HEIGHTWEIGHT_REPCNT3 )

#define	DETAIL_FADE_SPEED	( -2 )		// 詳細画面切り替えフェードスピード

// 分布データ切り替えワーク
typedef struct {
	u16	seq;
	u16	ev;
}ENCDATA_CHG_WORK;

// 分布切り替えデータ
#define	ENC_MAP_SCROLL_X_JOHTO	( -72 )
#define	ENC_MAP_SCROLL_X_KANTO	( 104 )
#define	ENC_MAP_SCROLL_SPEED	( 8 )


//============================================================================================
//	プロトタイプ宣言
//============================================================================================
static int MainSeq_Init( ZKN2_WORK * wk );
static int MainSeq_Release( ZKN2_WORK * wk );
static int MainSeq_Wipe( ZKN2_WORK * wk );
static int MainSeq_PaletteFade( ZKN2_WORK * wk );
static int MainSeq_ButtonAnm( ZKN2_WORK * wk );
static int MainSeq_Start( ZKN2_WORK * wk );

static int MainSeq_TopMain( ZKN2_WORK * wk );
static int MainSeq_TopSwitchChg( ZKN2_WORK * wk );
static int MainSeq_TopCoverOpen( ZKN2_WORK * wk );
static int MainSeq_TopCoverOut( ZKN2_WORK * wk );
static int MainSeq_TopSearchChg( ZKN2_WORK * wk );
static int MainSeq_ListMain( ZKN2_WORK * wk );
static int MainSeq_ListCoverIn( ZKN2_WORK * wk );
static int MainSeq_ListScroll_U( ZKN2_WORK * wk );
static int MainSeq_ListScroll_D( ZKN2_WORK * wk );
static int MainSeq_ListScroll_Bar( ZKN2_WORK * wk );
static int MainSeq_ListScroll_Rail( ZKN2_WORK * wk );
static int MainSeq_ListCoverClose( ZKN2_WORK * wk );
static int MainSeq_ListFadeOut( ZKN2_WORK * wk );
static int MainSeq_ListReturn( ZKN2_WORK * wk );
static int MainSeq_ListZukanEnd( ZKN2_WORK * wk );

static int MainSeq_SearchInit( ZKN2_WORK * wk );
static int MainSeq_SearchMain( ZKN2_WORK * wk );
static int MainSeq_SearchStart( ZKN2_WORK * wk );
static int MainSeq_SearchReset( ZKN2_WORK * wk );
static int MainSeq_SearchExit( ZKN2_WORK * wk );
static int MainSeq_SearchInputInit( ZKN2_WORK * wk );
static int MainSeq_SearchInputEnd( ZKN2_WORK * wk );
static int MainSeq_SearchRowInit( ZKN2_WORK * wk );
static int MainSeq_SearchRowMain( ZKN2_WORK * wk );
static int MainSeq_SearchRowEnd( ZKN2_WORK * wk );
static int MainSeq_SearchNameInit( ZKN2_WORK * wk );
static int MainSeq_SearchNameMain( ZKN2_WORK * wk );
static int MainSeq_SearchNameEnd( ZKN2_WORK * wk );
static int MainSeq_SearchTypeInit( ZKN2_WORK * wk );
static int MainSeq_SearchTypeMain( ZKN2_WORK * wk );
static int MainSeq_SearchTypeEnd( ZKN2_WORK * wk );
static int MainSeq_SearchHeightInit( ZKN2_WORK * wk );
static int MainSeq_SearchHeightMain( ZKN2_WORK * wk );
static int MainSeq_SearchHeightEnd( ZKN2_WORK * wk );
static int MainSeq_SearchHeightMaxTouch( ZKN2_WORK * wk );
static int MainSeq_SearchHeightMinTouch( ZKN2_WORK * wk );
static int MainSeq_SearchHeightMaxMoveOne( ZKN2_WORK * wk );
static int MainSeq_SearchHeightMinMoveOne( ZKN2_WORK * wk );
static int MainSeq_SearchWeightInit( ZKN2_WORK * wk );
static int MainSeq_SearchWeightMain( ZKN2_WORK * wk );
static int MainSeq_SearchWeightEnd( ZKN2_WORK * wk );
static int MainSeq_SearchWeightMaxTouch( ZKN2_WORK * wk );
static int MainSeq_SearchWeightMinTouch( ZKN2_WORK * wk );
static int MainSeq_SearchWeightMaxMoveOne( ZKN2_WORK * wk );
static int MainSeq_SearchWeightMinMoveOne( ZKN2_WORK * wk );
static int MainSeq_SearchAreaInit( ZKN2_WORK * wk );
static int MainSeq_SearchAreaMain( ZKN2_WORK * wk );
static int MainSeq_SearchAreaEnd( ZKN2_WORK * wk );
static int MainSeq_SearchFormInit( ZKN2_WORK * wk );
static int MainSeq_SearchFormMain( ZKN2_WORK * wk );
static int MainSeq_SearchFormEnd( ZKN2_WORK * wk );
static int MainSeq_SearchListMain( ZKN2_WORK * wk );
static int MainSeq_SearchScroll_U( ZKN2_WORK * wk );
static int MainSeq_SearchScroll_D( ZKN2_WORK * wk );
static int MainSeq_SearchScroll_Bar( ZKN2_WORK * wk );
static int MainSeq_SearchScroll_Rail( ZKN2_WORK * wk );
static int MainSeq_SearchReturnInput( ZKN2_WORK * wk );
static int MainSeq_SearchListEnd( ZKN2_WORK * wk );
static int MainSeq_SearchListRet( ZKN2_WORK * wk );
static int MainSeq_SearchDetailSet( ZKN2_WORK * wk );
static int MainSeq_DetailInit( ZKN2_WORK * wk );
static int MainSeq_DetailEnd( ZKN2_WORK * wk );
static int MainSeq_EncountInit( ZKN2_WORK * wk );
static int MainSeq_EncountMain( ZKN2_WORK * wk );
static int MainSeq_EncountEnd( ZKN2_WORK * wk );
static int MainSeq_EncountScroll_U( ZKN2_WORK * wk );
static int MainSeq_EncountScroll_D( ZKN2_WORK * wk );
static int MainSeq_EncountScroll_Bar( ZKN2_WORK * wk );
static int MainSeq_EncountScroll_Rail( ZKN2_WORK * wk );
static int MainSeq_EncountDataChange( ZKN2_WORK * wk );
static int MainSeq_SizeInit( ZKN2_WORK * wk );
static int MainSeq_SizeMain( ZKN2_WORK * wk );
static int MainSeq_SizeEnd( ZKN2_WORK * wk );
static int MainSeq_FormInit( ZKN2_WORK * wk );
static int MainSeq_FormMain( ZKN2_WORK * wk );
static int MainSeq_FormEnd( ZKN2_WORK * wk );
static int MainSeq_FormScroll_U( ZKN2_WORK * wk );
static int MainSeq_FormScroll_D( ZKN2_WORK * wk );
static int MainSeq_FormScroll_Bar( ZKN2_WORK * wk );
static int MainSeq_FormScroll_Rail( ZKN2_WORK * wk );
static int MainSeq_Form2Init( ZKN2_WORK * wk );
static int MainSeq_Form2Main( ZKN2_WORK * wk );
static int MainSeq_Form2End( ZKN2_WORK * wk );
static int MainSeq_DetailRetInit( ZKN2_WORK * wk );
static int MainSeq_DetailRetMain( ZKN2_WORK * wk );
static int MainSeq_DetailRetEnd( ZKN2_WORK * wk );

static int MainSeq_EndSet( ZKN2_WORK * wk );

static int FadeInSet( ZKN2_WORK * wk, int next );
static int FadeOutSet( ZKN2_WORK * wk, int next );
static int ListButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 sx, int next );
static int SearchMainButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 sx, int next );
static int SearchInputButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 py, u8 sx, u8 sy, int next );
static int DetailButtonAnmPut( ZKN2_WORK * wk, u8 px, int next );
static int FormButtonAnmPut( ZKN2_WORK * wk, u8 frm, u8 px, u8 py, u8 sx, u8 sy, int next );

static void ZukanModeSet( ZKN2_WORK * wk, u32 mode );
static void ZukanModeChange( ZKN2_WORK * wk, u32 mode );
static void ZukanModeRemakeList( ZKN2_WORK * wk );
static void DefaultListPosSet( ZKN2_WORK * wk );

static void SearchInputWorkSet( ZKN2_WORK * wk, u32 init, u32 pos, u32 next );

static void SaerchBGWFSet( ZKN2_WORK * wk, u32 bgfrm, u32 bgfID );

static void ListButtonOnOffSet( ZKN2_WORK * wk );
static void SearchListButtonOnOffSet( ZKN2_WORK * wk );

static BOOL FormListScrollSet( ZKN2_WORK * wk, s8 mv, u8 cnt );
static void Form2PosChange( s8 * p1, s8 p2, s8 mv, u8 max );
static BOOL Form2PokeIconChangeL( ZKN2_WORK * wk, s8 mv );
static BOOL Form2PokeIconChangeR( ZKN2_WORK * wk, s8 mv );
static void Form2PokeGraChange( ZKN2_WORK * wk );
static void DetailButtonPalChange( ZKN2_WORK * wk );

static void WeightAnime( ZKN2_WORK * wk );
static void WeightAnimeWorkFree( ZKN2_WORK * wk );

static BOOL PlaceListScrollSet( ZKN2_WORK * wk, s8 mv, u8 cnt );
static BOOL EncountTimeChange( ZKN2_WORK * wk, s8 time );
static BOOL EncountModeChange( ZKN2_WORK * wk, s8 mode );
static void EncountModeSwitchChg( ZKN2_WORK * wk );
static void EncountMapScrollInit( ZKN2_WORK * wk );
static void EncountMapScrollDelete( ZKN2_WORK * wk );
static BOOL EncountMapScroll( ZKN2_WORK * wk );
static void EncountPosAlpha( ZKN2_WORK * wk );
static void EncountPosAlphaInit( ZKN2_WORK * wk );

static BOOL PokeVoicePlay( ZKN2_WORK * wk );

static void SearchHWParamInc( u32 * prm, s32 min, s32 max, u32 * cnt, s32 mv );
static void SearchHWBarMovePos( ZKN2_WORK * wk, u32 prm, u32 mode, u32 obj_id, u32 bmp_id );


//============================================================================================
//	グローバル変数
//============================================================================================

// メインシーケンステーブル
static const pZkn2Func MainSeq[] = {
	MainSeq_Init,
	MainSeq_Release,
	MainSeq_Wipe,
	MainSeq_PaletteFade,
	MainSeq_ButtonAnm,

	MainSeq_Start,

	MainSeq_TopMain,
	MainSeq_TopSwitchChg,
	MainSeq_TopCoverOpen,
	MainSeq_TopCoverOut,
	MainSeq_TopSearchChg,

	MainSeq_ListMain,
	MainSeq_ListCoverIn,
	MainSeq_ListScroll_U,
	MainSeq_ListScroll_D,
	MainSeq_ListScroll_Bar,
	MainSeq_ListScroll_Rail,
	MainSeq_ListCoverClose,
	MainSeq_ListFadeOut,
	MainSeq_ListReturn,
	MainSeq_ListZukanEnd,

	MainSeq_SearchInit,
	MainSeq_SearchMain,
	MainSeq_SearchStart,
	MainSeq_SearchReset,
	MainSeq_SearchExit,
	MainSeq_SearchInputInit,
	MainSeq_SearchInputEnd,
	MainSeq_SearchRowInit,
	MainSeq_SearchRowMain,
	MainSeq_SearchRowEnd,
	MainSeq_SearchNameInit,
	MainSeq_SearchNameMain,
	MainSeq_SearchNameEnd,
	MainSeq_SearchTypeInit,
	MainSeq_SearchTypeMain,
	MainSeq_SearchTypeEnd,
	MainSeq_SearchHeightInit,
	MainSeq_SearchHeightMain,
	MainSeq_SearchHeightEnd,
	MainSeq_SearchHeightMaxTouch,
	MainSeq_SearchHeightMinTouch,
	MainSeq_SearchHeightMaxMoveOne,
	MainSeq_SearchHeightMinMoveOne,
	MainSeq_SearchWeightInit,
	MainSeq_SearchWeightMain,
	MainSeq_SearchWeightEnd,
	MainSeq_SearchWeightMaxTouch,
	MainSeq_SearchWeightMinTouch,
	MainSeq_SearchWeightMaxMoveOne,
	MainSeq_SearchWeightMinMoveOne,
	MainSeq_SearchAreaInit,
	MainSeq_SearchAreaMain,
	MainSeq_SearchAreaEnd,
	MainSeq_SearchFormInit,
	MainSeq_SearchFormMain,
	MainSeq_SearchFormEnd,
	MainSeq_SearchListMain,
	MainSeq_SearchScroll_U,
	MainSeq_SearchScroll_D,
	MainSeq_SearchScroll_Bar,
	MainSeq_SearchScroll_Rail,
	MainSeq_SearchReturnInput,
	MainSeq_SearchListEnd,
	MainSeq_SearchDetailSet,
	MainSeq_SearchListRet,

	MainSeq_DetailInit,
	MainSeq_DetailEnd,
	MainSeq_EncountInit,
	MainSeq_EncountMain,
	MainSeq_EncountEnd,
	MainSeq_EncountScroll_U,
	MainSeq_EncountScroll_D,
	MainSeq_EncountScroll_Bar,
	MainSeq_EncountScroll_Rail,
	MainSeq_EncountDataChange,
	MainSeq_SizeInit,
	MainSeq_SizeMain,
	MainSeq_SizeEnd,
	MainSeq_FormInit,
	MainSeq_FormMain,
	MainSeq_FormEnd,
	MainSeq_FormScroll_U,
	MainSeq_FormScroll_D,
	MainSeq_FormScroll_Bar,
	MainSeq_FormScroll_Rail,
	MainSeq_Form2Init,
	MainSeq_Form2Main,
	MainSeq_Form2End,
	MainSeq_DetailRetInit,
	MainSeq_DetailRetMain,
	MainSeq_DetailRetEnd,

	MainSeq_EndSet,
};


//--------------------------------------------------------------------------------------------
/**
 * シーケンス処理
 *
 * @param	wk		図鑑画面ワーク
 * @param	seq		シーケンス
 *
 * @retval	"TRUE = 処理中"
 * @retval	"FALSE = 終了"
 */
//--------------------------------------------------------------------------------------------
BOOL ZKN2SEQ_Main( ZKN2_WORK * wk, int * seq )
{
	*seq = MainSeq[*seq]( wk );

	if( *seq == ZKN2SEQ_MAINSEQ_END ){
		return FALSE;
	}

	BGWINFRM_MoveMain( wk->wfrm );
	ZKN2OBJ_AnmMain( wk );
	CATS_Draw( wk->crp );

	return TRUE;
}


//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Init( ZKN2_WORK * wk )
{
	// 割り込み停止
	sys_VBlankFuncChange( NULL, NULL );
	sys_HBlankIntrStop();
	// 表示初期化
	GF_Disp_GX_VisibleControlDirect( 0 );
	GF_Disp_GXS_VisibleControlDirect( 0 );
	// ブレンド初期化
	G2_BlendNone();
	G2S_BlendNone();
	// タッチパネルシステム初期化
	InitTPSystem();
	InitTPNoBuff( 4 );
	// サブ画面をメインに
	GX_SetDispSelect( GX_DISP_SELECT_SUB_MAIN );
	// キーリピート設定
	sys_KeyRepeatSpeedSet( SYS_KEYREPEAT_SPEED_DEF, SYS_KEYREPEAT_WAIT_DEF );

	ZKN2MAIN_SearchDataLoad( wk );
	ZKN2MAIN_HeightWeightLoad( wk );

	APP_WipeStart( APP_WIPE_IN, HEAPID_ZUKAN );

	FontProc_LoadFont( FONT_TOUCH, HEAPID_ZUKAN );

	wk->graphic_ah = ArchiveDataHandleOpen( ARC_ZUKAN2_GRA, HEAPID_ZUKAN );

	ZKN2MAIN_SearchParamInit( wk );		// 検索パラメータ初期化

	ZKN2LIST_MonsListTblMake(
		wk, wk->zkn_mode,
		ZKN2LIST_SORT_NORMAL,			// ポケモンナンバー
		ZKN2LIST_SEARCH_NAME_NONE,		// 名前
		ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
		ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
		0,								// 高さ（低）
		ZKN2_HW_DOT_MAX,				// 高さ（高）
		0,								// 重さ（低）
		ZKN2_HW_DOT_MAX,				// 重さ（高）
		ZKN2LIST_SEARCH_AREA_MASK_NONE,	// 地域
		ZKN2LIST_SEARCH_FORM_NONE );	// 形

	ZKN2LIST_ListPutMake( wk, TRUE );

	DefaultListPosSet( wk );

	ZKN2MAIN_VramBankSet();
	ZKN2MAIN_BgInit( wk );
	ZKN2MAIN_BgWinFrmInit( wk );
	ZKN2MAIN_PaletteFadeInit( wk );

	ZKN2MAIN_MsgInit( wk );

	ZKN2OBJ_Init( wk );

	ZKN2MAIN_SetBlendAlpha();

	Snd_DataSetByScene( SND_SCENE_SUB_ZUKAN, 0, 0 );	// サウンドデータロード

	sys_VBlankFuncChange( ZKN2MAIN_VBlank, wk );

	return wk->next_seq;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：解放
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Release( ZKN2_WORK * wk )
{
	sys_VBlankFuncChange( NULL, NULL );

	ZKN2BMP_Exit( wk );

	ZKN2OBJ_Exit( wk );

	ZKN2MAIN_MsgExit( wk );

	ZKN2MAIN_PaletteFadeExit( wk );
	ZKN2MAIN_BgWinFrmExit( wk );
	ZKN2MAIN_BgExit( wk );

	ArchiveDataHandleClose( wk->graphic_ah );

	FontProc_UnloadFont( FONT_TOUCH );

	ZKN2MAIN_HeightWeightFree( wk );
	ZKN2MAIN_SearchDataFree( wk );

	StopTP();	// タッチパネル終了

	G2_BlendNone();
	G2S_BlendNone();

	GF_Disp_GX_VisibleControlDirect( 0 );
	GF_Disp_GXS_VisibleControlDirect( 0 );

	return wk->next_seq;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：ワイプ処理待ち
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Wipe( ZKN2_WORK * wk )
{
	if( WIPE_SYS_EndCheck() == TRUE ){
		return wk->wipe_seq;
	}
	return ZKN2SEQ_MAINSEQ_WIPE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：パレットフェード
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_PaletteFade( ZKN2_WORK * wk )
{
	if( PaletteFadeCheck( wk->pfd ) == 0 ){
		return wk->next_seq;
	}
	return ZKN2SEQ_MAINSEQ_PALETTE_FADE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：ボタンアニメ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ButtonAnm( ZKN2_WORK * wk )
{
	BUTTON_ANM_WORK * swk = (BUTTON_ANM_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		GF_BGL_ScrPalChange( wk->bgl, swk->frm, swk->px, swk->py, swk->sx, swk->sy, swk->p_pal );
		GF_BGL_LoadScreenV_Req( wk->bgl, swk->frm );
		swk->seq++;
		break;

	case 1:
		swk->cnt++;
		if( swk->cnt == 4 ){
			GF_BGL_ScrPalChange( wk->bgl, swk->frm, swk->px, swk->py, swk->sx, swk->sy, swk->n_pal );
			GF_BGL_LoadScreenV_Req( wk->bgl, swk->frm );
			swk->cnt = 0;
			swk->seq++;
		}
		break;

	case 2:
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return wk->next_seq;
	}

	return ZKN2SEQ_MAINSEQ_BUTTON_ANM;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：開始
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Start( ZKN2_WORK * wk )
{
	wk->page = ZKN_PAGE_LIST;
	ZKN2MAIN_PageInit( wk, ZKN_PAGE_LIST );

	PaletteFadeReq( wk->pfd, PF_BIT_NORMAL_ALL, 0xffff, -127, 0, 0, 0 );

	// 開始のワイプは絵を読み込む前に設定しないとダメ
//	return FadeInSet( wk, ZKN2SEQ_MAINSEQ_TOP_MAIN );
	wk->wipe_seq = ZKN2SEQ_MAINSEQ_TOP_MAIN;
	return ZKN2SEQ_MAINSEQ_WIPE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：トップ画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_TopMain( ZKN2_WORK * wk )
{
	switch( ZKN2UI_TopMain( wk ) ){
	case ZKN2UI_TOP_OPEN:			// 開く
		Snd_SePlay( SE_ZKN2_OPEN );
		return ListButtonAnmSet( wk, 8, 16, ZKN2SEQ_MAINSEQ_TOP_COVER_OUT );

	case ZKN2UI_TOP_SUARCH:			// 探す
		if( wk->ui_flg == 0 ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_DECIDE );
		}
		return ListButtonAnmSet( wk, 0, 8, ZKN2SEQ_MAINSEQ_TOP_SEARCH_CHG );

	case ZKN2UI_TOP_CANCEL:			// 終わる
		if( wk->ui_flg == 0 ){
			KeyTouchStatus_SetTouchOrKey( wk->dat->kt_status, APP_END_TOUCH );
		}else{
			KeyTouchStatus_SetTouchOrKey( wk->dat->kt_status, APP_END_KEY );
		}
		Snd_SePlay( SE_ZKN2_CANCEL );
		return ListButtonAnmSet( wk, 24, 8, ZKN2SEQ_MAINSEQ_END_SET );

	case ZKN2UI_TOP_LEFT:			// 左キー
		Snd_SePlay( SE_ZKN2_MODE_CHG );
		ZukanModeSet( wk, ZKN2_MODE_ZENKOKU );
		break;

	case ZKN2UI_TOP_RIGHT:			// 右キー
		Snd_SePlay( SE_ZKN2_MODE_CHG );
		ZukanModeSet( wk, ZKN2_MODE_JOHTO );
		break;

	case ZKN2UI_TOP_COVER:			// カバーを開く動作へ（タッチ）
		{
			COVER_TOUCH_WORK * swk = (COVER_TOUCH_WORK *)wk->seq_work;
			GF_TP_GetPointTrg( &swk->x, &swk->y );
			swk->obj_def_x = ZKN2OBJ_CoverDefObjPxGet( wk );
		}
		Snd_SePlay( SE_ZKN2_OPEN );
		return ZKN2SEQ_MAINSEQ_TOP_COVER_OPEN;

	case ZKN2UI_TOP_SWITCH:			// 図鑑モード切り替え（タッチ）
		{
			u32	x, y;
			GF_TP_GetPointTrg( &x, &y );
			if( ZKN2OBJ_CoverSwitchCheck( wk, x, y ) == TRUE ){
				return ZKN2SEQ_MAINSEQ_TOP_SWITCH_CHG;
			}
		}
		break;

	default:
		break;
	}

	return ZKN2SEQ_MAINSEQ_TOP_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：トップ画面・図鑑モード切り替え
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_TopSwitchChg( ZKN2_WORK * wk )
{
	u32	x, y;

	if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
		ZukanModeRemakeList( wk );
		return ZKN2SEQ_MAINSEQ_TOP_MAIN;
	}

	if( x >= ( SWITCH_AREA_LX - SWITCH_AREA_PRM_X ) && x < ( SWITCH_AREA_RX + SWITCH_AREA_PRM_X ) &&
		y >= ( SWITCH_AREA_UY - SWITCH_AREA_PRM_Y ) && y < ( SWITCH_AREA_DY + SWITCH_AREA_PRM_Y ) ){
		if( x < SWITCH_AREA_LX ){
			x = SWITCH_AREA_LX;
		}else if( x > ( SWITCH_AREA_RX - 1 ) ){
			x = SWITCH_AREA_RX - 1;
		}
		if( y < SWITCH_AREA_UY ){
			y = SWITCH_AREA_UY;
		}else if( y > ( SWITCH_AREA_DY - 1 ) ){
			y = SWITCH_AREA_DY - 1;
		}
		if( ZKN2OBJ_CoverSwitchCheck( wk, x, y ) == FALSE ){
			if( wk->zkn_mode == ZKN2_MODE_ZENKOKU ){
				Snd_SePlay( SE_ZKN2_MODE_CHG );
				ZukanModeChange( wk, ZKN2_MODE_JOHTO );
			}else{
				Snd_SePlay( SE_ZKN2_MODE_CHG );
				ZukanModeChange( wk, ZKN2_MODE_ZENKOKU );
			}
		}
	}else{
		ZukanModeRemakeList( wk );
		return ZKN2SEQ_MAINSEQ_TOP_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_TOP_SWITCH_CHG;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：トップ画面・カバーオープン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_TopCoverOpen( ZKN2_WORK * wk )
{
	COVER_TOUCH_WORK * swk;
	u32	x, y;

	swk = (COVER_TOUCH_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
			if( GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M ) >= COVER_SCROLL_OPEN_POINT ){
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_TOP_COVER_OUT;
			}else{
				swk->seq++;
				break;
			}
		}
		if( (s32)(swk->x-x) < 0 ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, 0 );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, 0 );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, swk->obj_def_x );
		}else{
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, swk->x-x );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, swk->x-x );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, swk->obj_def_x-(swk->x-x) );
		}
		break;

	case 1:
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, COVER_MOVE_SCROLL_SPEED );
		if( GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M ) <= COVER_IN_SCROLL_CNT ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk) );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_TOP_MAIN;
		}
	}

	return ZKN2SEQ_MAINSEQ_TOP_COVER_OPEN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：トップ画面・カバーアウト
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_TopCoverOut( ZKN2_WORK * wk )
{
	COVER_MOVE_WORK * swk = (COVER_MOVE_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2MAIN_TopButtonOutStart( wk );
		swk->seq++;
	case 1:
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, -COVER_MOVE_SCROLL_SPEED );
		{
			int	scrx = GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M );

			if( swk->flg == 0 && scrx >= COVER_OUT_BTNIN_SCRX &&
				BGWINFRM_MoveCheck(wk->wfrm,ZKN2_BGWF_BTN_TOP) == 0 ){
				swk->flg = 1;
				ZKN2MAIN_ListButtonInStart( wk );
				ListButtonOnOffSet( wk );
			}

			if( scrx >= COVER_OUT_SCROLL_CNT ){
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
				ZKN2OBJ_CoverObjMove(
					wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk) - COVER_OUT_SCROLL_CNT );
				if( swk->flg == 1 ){
					swk->seq++;
				}
			}
		}
		break;

	case 2:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_LIST ) == 0 ){
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			ZKN2MAIN_ListLabelPut( wk );
			if( mons != 0 ){
				ZKN2OBJ_ListMainLangIconChg( wk, mons, ZKN2_OBJ_LANGICON_M );
//				ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, TRUE );
				if( ZKN2MAIN_LangChangeCheck( wk, mons ) == TRUE ){
					ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, TRUE );
				}
			}
			ZKN2BMP_ListLabelPokeNamePut( wk, mons, ZKN2_BMPWIN_LIST_POKE );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_LIST_MAIN;
		}
	}

	return ZKN2SEQ_MAINSEQ_TOP_COVER_OUT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：トップ画面・検索画面へ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_TopSearchChg( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2MAIN_TopButtonOutStart( wk );

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xfffe, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->seq_work[0]++;
		break;

	case 1:
		if( PaletteFadeCheck( wk->pfd ) == 0 ){
			wk->seq_work[0]++;
		}else{
			if( GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M ) >= COVER_OUT_SCROLL_CNT ){
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
				ZKN2OBJ_CoverObjMove(
					wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk) - COVER_OUT_SCROLL_CNT );
			}else{
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
				ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, -COVER_MOVE_SCROLL_SPEED );
			}
		}
		break;

	case 2:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_TOP ) == 0 ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, 0 );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, 0 );
			PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
			ZKN2BMP_Exit( wk );
			ZKN2OBJ_TopListObjDelete( wk );
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_SEARCH_INIT;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_TOP_SEARCH_CHG;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListMain( ZKN2_WORK * wk )
{
	switch( ZKN2UI_ListMain( wk, TRUE ) ){
	case ZKN2UI_LIST_MOVE:		// ポケモン切り替え
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_CURSOR );
		ZKN2MAIN_ListSelPosInfoPut( wk );
		ListButtonOnOffSet( wk );
		break;

	case ZKN2UI_LIST_CLOSE:		// 閉じる
		return ZKN2SEQ_MAINSEQ_LIST_COVER_IN;

	case ZKN2UI_LIST_SUARCH:	// 探す
		wk->page = ZKN_PAGE_SEARCH;
		return ListButtonAnmSet( wk, 0, 8, ZKN2SEQ_MAINSEQ_LIST_FADE_OUT );

	case ZKN2UI_LIST_VOICE:		// 鳴き声
		if( PokeVoicePlay( wk ) == TRUE ){
			return ListButtonAnmSet( wk, 8, 8, ZKN2SEQ_MAINSEQ_LIST_MAIN );
		}
		break;

	case ZKN2UI_LIST_INFO:		// 詳しく
		if( ZKN2LIST_SelMonsGet( wk ) != 0 ){
			Snd_SePlay( SE_ZKN2_DECIDE );
			wk->page = ZKN_PAGE_PLACE;
			return ListButtonAnmSet( wk, 16, 8, ZKN2SEQ_MAINSEQ_LIST_FADE_OUT );
		}
		break;

	case ZKN2UI_LIST_CANCEL:		// 終わる
		KeyTouchStatus_SetTouchOrKey( wk->dat->kt_status, APP_END_TOUCH );
		return ListButtonAnmSet( wk, 24, 8, ZKN2SEQ_MAINSEQ_LIST_ZUKAN_END );

	case ZKN2UI_LIST_CANCEL_BUTTON:	// 終わる（ボタン）
		KeyTouchStatus_SetTouchOrKey( wk->dat->kt_status, APP_END_KEY );
		return ListButtonAnmSet( wk, 24, 8, ZKN2SEQ_MAINSEQ_LIST_ZUKAN_END );

	case ZKN2UI_LIST_ARROW_L:	// 表示言語切り替え（左）
		ZKN2MAIN_LangChange( wk, ZKN2LIST_SelMonsGet( wk ), -1 );
		break;

	case ZKN2UI_LIST_ARROW_R:	// 表示言語切り替え（右）
		ZKN2MAIN_LangChange( wk, ZKN2LIST_SelMonsGet( wk ), 1 );
		break;

	case ZKN2UI_LIST_ARROW_U:	// ポケモンスクロール（上）
		if( wk->list_scr != 0 ){
//			Snd_SePlay( SE_ZKN2_SELECT );
			Snd_SePlay( SE_ZKN2_BUTTON );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_LIST_SCROLL_U;
		}
		break;

	case ZKN2UI_LIST_ARROW_U_KEY:	// ポケモンスクロール（上：キー）
		if( wk->list_scr != 0 ){
			LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;
#ifdef	GS_AFTERMASTER_SYSTEM1580_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			swk->key = 1;
			return ZKN2SEQ_MAINSEQ_LIST_SCROLL_U;
		}
		break;

	case ZKN2UI_LIST_ARROW_D:	// ポケモンスクロール（下）
		if( ( wk->list_scr + 1 ) <= ZKN2LIST_ListScrollMaxGet(wk,TRUE) ){
			Snd_SePlay( SE_ZKN2_BUTTON );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_LIST_SCROLL_D;
		}
		break;

	case ZKN2UI_LIST_ARROW_D_KEY:	// ポケモンスクロール（下：キー）
		if( ( wk->list_scr + 1 ) <= ZKN2LIST_ListScrollMaxGet(wk,TRUE) ){
			LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;
#ifdef	GS_AFTERMASTER_SYSTEM1580_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			swk->key = 1;
			return ZKN2SEQ_MAINSEQ_LIST_SCROLL_D;
		}
		break;

	case ZKN2UI_LIST_RAIL:		// ポケモンスクロール（フリー）
		{
			u32	x, y;
			GF_TP_GetPointCont( &x, &y );
			if( ZKN2OBJ_ListBarCheck( wk, ZKN2_OBJ_BAR, x, y ) == TRUE ){
				return ZKN2SEQ_MAINSEQ_LIST_SCROLL_BAR;
			}else{
				LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;
				swk->x = x;
				swk->y = y;
				return ZKN2SEQ_MAINSEQ_LIST_SCROLL_RAIL;
			}
		}
		break;

	case ZKN2UI_LIST_COVER:		// カバーを閉じる動作へ（タッチ）
		{
			COVER_TOUCH_WORK * swk = (COVER_TOUCH_WORK *)wk->seq_work;
			GF_TP_GetPointTrg( &swk->x, &swk->y );
		}
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		return ZKN2SEQ_MAINSEQ_LIST_COVER_CLOSE;

	default:
		break;
	}

	return ZKN2SEQ_MAINSEQ_LIST_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・カバーイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListCoverIn( ZKN2_WORK * wk )
{
	COVER_MOVE_WORK * swk = (COVER_MOVE_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		ZKN2MAIN_ListButtonOutStart( wk );
		swk->seq++;
	case 1:
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, COVER_MOVE_SCROLL_SPEED );
		{
			int	scrx = GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M );

			if( swk->flg == 0 && scrx < COVER_IN_BTNIN_SCRX &&
				BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_LIST ) == 0 ){
				swk->flg = 1;
				ZKN2MAIN_TopButtonInStart( wk );
			}

			if( scrx <= COVER_IN_SCROLL_CNT ){
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
				GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
				ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk) );
				if( swk->flg == 1 ){
					swk->seq++;
				}
			}
		}
		break;

	case 2:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_TOP ) == 0 ){
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_TOP_MAIN;
		}
	}

	return ZKN2SEQ_MAINSEQ_LIST_COVER_IN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・スクロール（番号減少）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListScroll_U( ZKN2_WORK * wk )
{
	LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2OBJ_ListCursorOff( wk );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_ARROW_U, ZKN2OBJ_M_ANM_UP_TOUCH );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		swk->scrn   = ZKN2MAIN_ListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*(wk->list_scr-1) );
		swk->bar_my = ZKN2OBJ_ListBarAotoMoveCntGet(
						wk, ZKN2_OBJ_BAR,
						ZKN2OBJ_ListBarPosYGet(wk,wk->list_scr-1,ZKN2_OBJ_BAR,TRUE),
						LIST_SCROLL_MAX );
		swk->seq++;
	case 1:
		swk->cnt++;
		ZKN2MAIN_ListBgScrollPut(
			wk,
			&swk->scrn[ 32*5*ZKN2_POKEICON_SEL_V_MAX - 32*LIST_SCROLL_SPD*swk->cnt] );
		ZKN2OBJ_PokeIconScroll_U( wk, ZKN2_OBJ_POKEICON, LIST_SCROLL_OBJ_SPD, swk->cnt / 5 );
		ZKN2OBJ_ListBarAotoMove( wk, ZKN2_OBJ_BAR, -swk->bar_my );

		if( swk->cnt == LIST_SCROLL_MAX ){
			swk->seq++;
		}
		break;

	case 2:
		if( swk->key == 1 ){
			wk->list_pos += ( ZKN2_POKEICON_PUT_H_MAX * 2);
		}
		wk->list_scr--;
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_CURSOR );
		ZKN2MAIN_ListBgScreenExit( swk->scrn );
		ZKN2MAIN_ListSelPosInfoPut( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_ARROW_U, TRUE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_BAR, TRUE );
		ListButtonOnOffSet( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_LIST_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_LIST_SCROLL_U;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・スクロール（番号増加）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListScroll_D( ZKN2_WORK * wk )
{
	LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2OBJ_ListCursorOff( wk );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_ARROW_D, ZKN2OBJ_M_ANM_DOWN_TOUCH );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		swk->scrn   = ZKN2MAIN_ListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		swk->bar_my = ZKN2OBJ_ListBarAotoMoveCntGet(
						wk, ZKN2_OBJ_BAR,
						ZKN2OBJ_ListBarPosYGet(wk,wk->list_scr+1,ZKN2_OBJ_BAR,TRUE),
						LIST_SCROLL_MAX );
		swk->seq++;
	case 1:
		swk->cnt++;
		ZKN2MAIN_ListBgScrollPut(
			wk,
			&swk->scrn[ 32*LIST_SCROLL_SPD*swk->cnt ] );
		ZKN2OBJ_PokeIconScroll_D( wk, ZKN2_OBJ_POKEICON, -LIST_SCROLL_OBJ_SPD, swk->cnt / 5 );
		ZKN2OBJ_ListBarAotoMove( wk, ZKN2_OBJ_BAR, swk->bar_my );

		if( swk->cnt == LIST_SCROLL_MAX ){
			swk->seq++;
		}
		break;

	case 2:
		if( swk->key == 1 ){
			wk->list_pos -= ( ZKN2_POKEICON_PUT_H_MAX * 2);
		}
		wk->list_scr++;
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_CURSOR );
		ZKN2MAIN_ListBgScreenExit( swk->scrn );
		ZKN2MAIN_ListSelPosInfoPut( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_ARROW_U, TRUE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_BAR, TRUE );
		ListButtonOnOffSet( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_LIST_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_LIST_SCROLL_D;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・スクロール（バー）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListScroll_Bar( ZKN2_WORK * wk )
{
	u32	x, y;

	if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
		return ZKN2SEQ_MAINSEQ_LIST_MAIN;
	}
	if( ZKN2OBJ_ListBarMove( wk, ZKN2_OBJ_BAR, x, y, TRUE ) == TRUE ){
		u16 * scrn = ZKN2MAIN_ListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		wk->icon_swap ^= 1;
		ZKN2MAIN_ListBgScrollPut( wk, scrn );
		ZKN2MAIN_ListBgScreenExit( scrn );
		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_POKEICON );
		ZKN2MAIN_ListSelPosInfoPut( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_ARROW_U, TRUE );
		ListButtonOnOffSet( wk );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}
	return ZKN2SEQ_MAINSEQ_LIST_SCROLL_BAR;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・スクロール（レール）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListScroll_Rail( ZKN2_WORK * wk )
{
	LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;

	if( ZKN2OBJ_ListBarMove( wk, ZKN2_OBJ_BAR, swk->x, swk->y, TRUE ) == TRUE ){
		u16 * scrn = ZKN2MAIN_ListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		wk->icon_swap ^= 1;
		ZKN2MAIN_ListBgScrollPut( wk, scrn );
		ZKN2MAIN_ListBgScreenExit( scrn );
		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_POKEICON );
		ZKN2MAIN_ListSelPosInfoPut( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_ARROW_U, TRUE );
		ListButtonOnOffSet( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}
	return ZKN2SEQ_MAINSEQ_LIST_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・カバークローズ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListCoverClose( ZKN2_WORK * wk )
{
	COVER_TOUCH_WORK * swk;
	u32	x, y;

	swk = (COVER_TOUCH_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
			if( GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M ) < COVER_SCROLL_CLOSE_POINT ){
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_LIST_COVER_IN;
			}else{
				swk->seq++;
				break;
			}
		}
		if( (s32)(COVER_OUT_SCROLL_CNT+swk->x-x) > COVER_OUT_SCROLL_CNT ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk)-COVER_OUT_SCROLL_CNT );
		}else{
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT+swk->x-x );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT+swk->x-x );
			ZKN2OBJ_CoverObjMove(
				wk, ZKN2_OBJ_SWITCH,
				ZKN2OBJ_CoverDefObjPxGet(wk)-COVER_OUT_SCROLL_CNT-(swk->x-x) );
		}
		break;

	case 1:
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_INC, COVER_MOVE_SCROLL_SPEED );
		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, -COVER_MOVE_SCROLL_SPEED );
		if( GF_BGL_ScrollGetX( wk->bgl, ZKN2_BGF_COVER_M ) > COVER_OUT_SCROLL_CNT ){
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			ZKN2MAIN_ListLabelPut( wk );
			if( mons != 0 ){
				ZKN2OBJ_ListMainLangIconChg( wk, mons, ZKN2_OBJ_LANGICON_M );
//				ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, TRUE );
				if( ZKN2MAIN_LangChangeCheck( wk, mons ) == TRUE ){
					ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, TRUE );
				}
			}
			ZKN2BMP_ListLabelPokeNamePut( wk, mons, ZKN2_BMPWIN_LIST_POKE );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk)-COVER_OUT_SCROLL_CNT );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_LIST_MAIN;
		}
	}

	return ZKN2SEQ_MAINSEQ_LIST_COVER_CLOSE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・他のページへ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListFadeOut( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		ZKN2MAIN_ListButtonOutStart( wk );

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xfffe, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_LIST_FADE_OUT;

		wk->seq_work[0]++;

		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_LIST ) == 0 ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, 0 );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, 0 );
			PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
			ZKN2BMP_Exit( wk );
			ZKN2OBJ_TopListObjDelete( wk );
			wk->seq_work[0] = 0;
			if( wk->page == ZKN_PAGE_SEARCH ){
				return ZKN2SEQ_MAINSEQ_SEARCH_INIT;
			}else{
				wk->detail_ret = ZKN_PAGE_LIST;
				return ZKN2SEQ_MAINSEQ_DETAIL_INIT;
			}
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_LIST_FADE_OUT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchInit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_SEARCH );
		ZKN2MAIN_SearchTopButtonInStart( wk );
		ZKN2UI_SearchMainCursorMoveSet( wk, ZKN2UI_SEARCH_ROW );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;
	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_TOP ) == 0 ){
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_SEARCH_MAIN;
		}
		break;
	}
	return ZKN2SEQ_MAINSEQ_SEARCH_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchMain( ZKN2_WORK * wk )
{
	switch( ZKN2UI_SearchMain(wk) ){
	case ZKN2UI_SEARCH_ROW:			// 00: 並び順
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 16, 1, 11, 2, ZKN2SEQ_MAINSEQ_SEARCH_ROW_INIT );

	case ZKN2UI_SEARCH_NAME:		// 01: 名前
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 7, 4, 9, 2, ZKN2SEQ_MAINSEQ_SEARCH_NAME_INIT );

	case ZKN2UI_SEARCH_TYPE:		// 02: タイプ
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 7, 7, 15, 2, ZKN2SEQ_MAINSEQ_SEARCH_TYPE_INIT );

	case ZKN2UI_SEARCH_HEIGHT:		// 03: 高さ
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 7, 10, 14, 2, ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_INIT );

	case ZKN2UI_SEARCH_WEIGHT:		// 04: 重さ
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 7, 13, 20, 2, ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_INIT );

	case ZKN2UI_SEARCH_AREA:		// 05: 地域
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 7, 16, 7, 2, ZKN2SEQ_MAINSEQ_SEARCH_AREA_INIT );

	case ZKN2UI_SEARCH_FORM:		// 06: 形
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchInputButtonAnmSet( wk, 26, 7, 4, 4, ZKN2SEQ_MAINSEQ_SEARCH_FORM_INIT );

	case ZKN2UI_SEARCH_RESET:		// 07: リセット
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet( wk, 0, 10, ZKN2SEQ_MAINSEQ_SEARCH_RESET );

	case ZKN2UI_SEARCH_START:		// 08: スタート
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet( wk, 11, 10, ZKN2SEQ_MAINSEQ_SEARCH_START );

	case ZKN2UI_SEARCH_EXIT:		// 09: やめる
	case CURSORMOVE_CANCEL:			// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		return SearchMainButtonAnmSet( wk, 22, 10, ZKN2SEQ_MAINSEQ_SEARCH_EXIT );

	case CURSORMOVE_CURSOR_MOVE:	// 移動
		break;

	case CURSORMOVE_CURSOR_ON:		// カーソル表示
	case CURSORMOVE_NONE:			// 動作なし
	default:
		break;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・スタート
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchStart( ZKN2_WORK * wk )
{
	SEARCH_START_WORK * swk = (SEARCH_START_WORK *)wk->seq_work;

	switch( swk->seq ){
	case SEARCH_START_SEQ_GAGE_ANM:		// ゲージアニメ開始
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_GAGE, 2 );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_GAGE, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_START );
		ZKN2MAIN_SearchTopButtonOutStart( wk );
		Snd_SePlay( SE_ZKN2_SEARCH );
		swk->seq = SEARCH_START_SEQ_LIST_MAKE;
		break;

	case SEARCH_START_SEQ_LIST_MAKE:	// リスト作成
		ZKN2LIST_MonsListTblMake(
			wk, wk->zkn_mode,
			wk->search_prm[ZKN2_SEARCH_PRM_ROW],		// ポケモンナンバー
			wk->search_prm[ZKN2_SEARCH_PRM_NAME],		// 名前
			wk->search_prm[ZKN2_SEARCH_PRM_TYPE1],		// タイプ
			wk->search_prm[ZKN2_SEARCH_PRM_TYPE2],		// タイプ
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L],	// 高さ（低）
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H],	// 高さ（高）
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L],	// 重さ（低）
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H],	// 重さ（高）
			(1<<wk->search_prm[ZKN2_SEARCH_PRM_AREA]),	// 地域
			wk->search_prm[ZKN2_SEARCH_PRM_FORM] );		// 形

		if( wk->mons_list.get_num == 0 && wk->mons_list.see_num == 0 ){
			swk->seq = SEARCH_START_SEQ_ERR_YADON_START;
		}else{
			ZKN2LIST_ListPutMake( wk, FALSE );
			wk->list_pos = 0;
			wk->list_scr = 0;
			wk->lang = PM_LANG;
			swk->seq = SEARCH_START_SEQ_BGWF_MAKE1;
		}
		break;

	case SEARCH_START_SEQ_BGWF_MAKE1:	// BGWF作成１
		SaerchBGWFSet( wk, ZKN2_BGF_COVER_M, ZKN2_BGWF_SEARCH_BG_D1 );
		swk->seq = SEARCH_START_SEQ_BGWF_MAKE2;
		break;

	case SEARCH_START_SEQ_BGWF_MAKE2:	// BGWF作成２
		SaerchBGWFSet( wk, ZKN2_BGF_CENTER_M, ZKN2_BGWF_SEARCH_BG_D2 );
		swk->seq = SEARCH_START_SEQ_BGWF_MAKE3;
		break;

	case SEARCH_START_SEQ_BGWF_MAKE3:	// BGWF作成３
		SaerchBGWFSet( wk, ZKN2_BGF_COVER_M, ZKN2_BGWF_SEARCH_BG_U1 );
		swk->seq = SEARCH_START_SEQ_BGWF_MAKE4;
		break;

	case SEARCH_START_SEQ_BGWF_MAKE4:	// BGWF作成４
		SaerchBGWFSet( wk, ZKN2_BGF_CENTER_M, ZKN2_BGWF_SEARCH_BG_U2 );
		swk->seq = SEARCH_START_SEQ_BMPWIN_SET;
		break;

	case SEARCH_START_SEQ_BMPWIN_SET:	// BMPWINに書き込み
		ZKN2BMP_SearchListSet( wk );
		swk->seq = SEARCH_START_SEQ_POKEICON_SET;
		break;

	case SEARCH_START_SEQ_POKEICON_SET:	// ポケアイコンセット
//		ZKN2OBJ_SearchPokeIconListInit( wk, ZKN2_OBJ_SEARCH_POKEICON );
		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_SEARCH_POKEICON );
		ZKN2MAIN_SearchListBgSet( wk );
		swk->seq = SEARCH_START_SEQ_OBJ_SET;
		break;

	case SEARCH_START_SEQ_OBJ_SET:		// その他OBJセット
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_BAR, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_ARROW_U, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_ARROW_D, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_RAIL, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_LISTICON, TRUE );
		ZKN2OBJ_ListBarAnmChg( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, FALSE );
		swk->seq = SEARCH_START_SEQ_YADON_ANM;
		break;

	case SEARCH_START_SEQ_YADON_ANM:	// ヤドンアニメ開始
		if( ZKN2OBJ_AnmGet( wk, ZKN2_OBJ_SEARCH_GAGE ) == FALSE ){
			ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_YADON, 1 );
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_GAGE, FALSE );
			swk->seq = SEARCH_START_SEQ_BGWF_SET;
		}
		break;

	case SEARCH_START_SEQ_BGWF_SET:		// BGWF移動
		swk->cnt++;
		if( swk->cnt == SEARCH_START_YADON_WAIT ){
			ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_ENTER );
			ZKN2OBJ_SearchFormSubMoveInit( wk );
			ZKN2OBJ_SearchFormSubMove( wk, -8 );
			ZKN2MAIN_SearchSubWindowMask( TRUE );
			BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D1, 0, 0 );
			BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D2, 0, 0 );
			BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U1, 0, 24 );
			BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U2, 0, 24 );
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D1, 0, -1, 24 );
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D2, 0, -1, 24 );
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U1, 0, -1, 24 );
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U2, 0, -1, 24 );
			Snd_SePlay( SE_ZKN2_SEARCH_WIN_UP );
			swk->cnt = 0;
			swk->seq = SEARCH_START_SEQ_BGWF_WAIT;
		}
		break;

	case SEARCH_START_SEQ_BGWF_WAIT:	// BGWF移動待ち
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D1 ) == 0 ){
			ZKN2MAIN_SearchSubWindowMask( FALSE );
			swk->seq = SEARCH_START_SEQ_BTN_IN;
		}else{
			ZKN2OBJ_SearchFormSubMove( wk, -8 );
		}
		break;

	case SEARCH_START_SEQ_BTN_IN:		// ボタンイン
		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_btn01_m_lz_NCGR,
			wk->bgl, ZKN2_BGF_CENTER_M, 0, 0, TRUE, HEAPID_ZUKAN );
		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_list_s_lz_NCGR,
			wk->bgl, ZKN2_BGF_UNDER_S, 0, 0, TRUE, HEAPID_ZUKAN );
		ArcUtil_HDL_ScrnSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_list01_s_lz_NSCR,
			wk->bgl, ZKN2_BGF_UNDER_S, 0, 0, TRUE, HEAPID_ZUKAN );
		ZKN2MAIN_SearchListButtonInStart( wk );
		ZKN2OBJ_SearchInputObjDelete( wk );
		swk->seq = SEARCH_START_SEQ_BTN_IN_WAIT;
		break;

	case SEARCH_START_SEQ_BTN_IN_WAIT:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_LIST ) == 0 ){
			swk->seq = SEARCH_START_SEQ_POKESELECT;
		}
		break;

	case SEARCH_START_SEQ_POKESELECT:	// ポケモン選択へ
		ZKN2UI_CursorMoveWorkExit( wk );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, TRUE );
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_SEARCH_CURSOR );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_CURSOR, ZKN2OBJ_M_ANM_LIST_CUR );
		ZKN2OBJ_SearchPageListLoad( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2MAIN_ListLabelPut( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;

	// ここからエラー専用処理
	case SEARCH_START_SEQ_ERR_YADON_START:	// エラー用ヤドンアニメ開始
		if( ZKN2OBJ_AnmGet( wk, ZKN2_OBJ_SEARCH_GAGE ) == FALSE ){
			ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_YADON, 3 );
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_GAGE, FALSE );
			swk->seq = SEARCH_START_SEQ_ERR_YADON_WAIT;
		}
		break;

	case SEARCH_START_SEQ_ERR_YADON_WAIT:	// エラー用ヤドンアニメ終了待ち
		if( ZKN2OBJ_AnmGet( wk, ZKN2_OBJ_SEARCH_YADON ) == FALSE ){
			// 上画面にエラー表示
			ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_ERROR );
			Snd_SePlay( SE_ZKN2_SEARCH_FAIL );
			swk->seq = SEARCH_START_SEQ_ERROR_WAIT;
		}
		break;

	case SEARCH_START_SEQ_ERROR_WAIT:	// エラー終了待ち
		swk->cnt++;
		if( ( sys.trg & (PAD_BUTTON_A|PAD_BUTTON_B) ) ||
			GF_TP_GetTrg() == TRUE ||
			swk->cnt == SEARCH_ERROR_WAIT ){

			ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_INIT );
			ZKN2MAIN_SearchTopButtonInStart( wk );
			swk->cnt = 0;
			swk->seq = SEARCH_START_SEQ_RETURN;
		}
		break;

	case SEARCH_START_SEQ_RETURN:		// 検索入力へ
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_TOP ) == 0 ){
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, TRUE );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_SEARCH_MAIN;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_START;
}

//--------------------------------------------------------------------------------------------
/**
 * BGスクリーンからBGWFにセット
 *
 * @param	wk		図鑑画面ワーク
 * @param	bgfrm	ＢＧフレーム
 * @param	bgfID	ＢＧウィンドウフレームＩＤ
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void SaerchBGWFSet( ZKN2_WORK * wk, u32 bgfrm, u32 bgfID )
{
	u16 * scr = GF_BGL_ScreenAdrsGet( wk->bgl, bgfrm );

	BGWINFRM_FrameSet( wk->wfrm, bgfID, scr );
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・リセット
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchReset( ZKN2_WORK * wk )
{
	ZKN2MAIN_SearchParamInit( wk );
	ZKN2BMP_SearchParamPut( wk );
	ZKN2OBJ_MainFormSet( wk );
	return ZKN2SEQ_MAINSEQ_SEARCH_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・やめる
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchExit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2MAIN_SearchTopButtonOutStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_EXIT;
		wk->seq_work[0]++;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
		ZKN2UI_CursorMoveWorkExit( wk );
		ZKN2BMP_Exit( wk );
		ZKN2OBJ_SearchObjDelete( wk );
		ZKN2OBJ_SearchInputObjDelete( wk );
		wk->seq_work[0] = 0;
		return ZKN2SEQ_MAINSEQ_LIST_RETURN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_EXIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：他ページからリストページへ復帰
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListReturn( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2LIST_MonsListTblMake(
			wk, wk->zkn_mode,
			ZKN2LIST_SORT_NORMAL,			// ポケモンナンバー
			ZKN2LIST_SEARCH_NAME_NONE,		// 名前
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			0,								// 高さ（低）
			ZKN2_HW_DOT_MAX,				// 高さ（高）
			0,								// 重さ（低）
			ZKN2_HW_DOT_MAX,				// 重さ（高）
			ZKN2LIST_SEARCH_AREA_MASK_NONE,	// 地域
			ZKN2LIST_SEARCH_FORM_NONE );	// 形
		ZKN2LIST_ListPutMake( wk, TRUE );
		wk->seq_work[0]++;
		break;

	case 1:
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_LIST );

		if( ZKN2LIST_SelPosGet( wk ) >= ZKN2LIST_ListMaxGet( wk, TRUE ) ){
			ZKN2MAIN_PokeInfoBgPutMax( wk->bgl, ZKN2_BGF_UNDER_S, wk->graphic_ah, HEAPID_ZUKAN );
			GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_U_TITLE] );
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_NAZOPOKE_S, FALSE );
		}

		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_BTN_TOP );
		ZKN2MAIN_ListButtonInStart( wk );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_OUT_SCROLL_CNT );
		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, -COVER_OUT_SCROLL_CNT );

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xfffe, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_LIST_RETURN;
		wk->seq_work[0]++;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 2:
		// 名前表示
		{
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			ZKN2MAIN_ListLabelPut( wk );
#if	BTS_5499_FIX
			if( mons != 0 ){
				ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, TRUE );
			}else{
				ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
			}
#else
			ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, TRUE );
#endif
			if( ZKN2MAIN_LangChangeCheck( wk, mons ) == TRUE ){
				ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, TRUE );
			}
			ZKN2BMP_ListLabelPokeNamePut( wk, mons, ZKN2_BMPWIN_LIST_POKE );
		}
		wk->seq_work[0] = 0;
		return ZKN2SEQ_MAINSEQ_LIST_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_LIST_RETURN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：リスト画面・カバーを閉じつつ図鑑終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_ListZukanEnd( ZKN2_WORK * wk )
{
	COVER_MOVE_WORK * swk = (COVER_MOVE_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_LIST_POKE] );
		ZKN2MAIN_ListButtonOutStart( wk );
		swk->cnt = 0;
		swk->seq++;
	case 1:
		if( swk->cnt == LIST_ZUKAN_END_FADE_START_CNT ){
			FadeOutSet( wk, ZKN2SEQ_MAINSEQ_END );
		}else if( swk->cnt > LIST_ZUKAN_END_FADE_START_CNT ){
			if( WIPE_SYS_EndCheck() == TRUE ){
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				wk->next_seq = ZKN2SEQ_MAINSEQ_END;
				return ZKN2SEQ_MAINSEQ_RELEASE;
			}
		}
		swk->cnt++;

		if( GF_BGL_ScrollGetX(wk->bgl,ZKN2_BGF_COVER_M) == COVER_IN_SCROLL_CNT ){
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, COVER_IN_SCROLL_CNT );
			ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SWITCH, ZKN2OBJ_CoverDefObjPxGet(wk) );
		}else{
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_DEC, COVER_MOVE_SCROLL_SPEED );
			ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SWITCH, COVER_MOVE_SCROLL_SPEED );
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_LIST_ZUKAN_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・入力画面初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchInputInit( ZKN2_WORK * wk )
{
	SEARCH_INPUT_INIT_WORK * swk = (SEARCH_INPUT_INIT_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
//		ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_NONE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2MAIN_SearchTopButtonOutStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
		swk->seq++;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		ZKN2UI_CursorMoveWorkExit( wk );
		ZKN2MAIN_SearchInputButtonInStart( wk );
		ZKN2MAIN_SearchInputInit( wk, swk->init, swk->pos );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->next_seq = swk->next;
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・入力画面からメインへ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchInputEnd( ZKN2_WORK * wk )
{
	SEARCH_INPUT_INIT_WORK * swk = (SEARCH_INPUT_INIT_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
//		ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_NONE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2MAIN_SearchInputButtonOutStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
		swk->seq++;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		ZKN2UI_CursorMoveWorkExit( wk );
		ZKN2MAIN_SearchTopButtonInStart( wk );
		ZKN2MAIN_SearchInputInit( wk, ZKN2MAIN_SEARCHINIT_MAIN, swk->pos );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->next_seq = swk->next;
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}


//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・並び順初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchRowInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_ROW];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_ROW, 0, ZKN2SEQ_MAINSEQ_SEARCH_ROW_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・並び順メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchRowMain( ZKN2_WORK * wk )
{
	switch( ZKN2UI_SearchRowMain(wk) ){
	case ZKN2UI_SEARCH_ROW_NUM:		// 00: ばんごう
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 0 );
		break;

	case ZKN2UI_SEARCH_ROW_STR:		// 01: ごじゅうおん
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 1 );
		break;

	case ZKN2UI_SEARCH_ROW_WH:		// 02: おもい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 2 );
		break;

	case ZKN2UI_SEARCH_ROW_WL:		// 03: かるい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 3 );
		break;

	case ZKN2UI_SEARCH_ROW_HH:		// 04: たかい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 4 );
		break;

	case ZKN2UI_SEARCH_ROW_HL:		// 05: ひくい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchRowSelect( wk, 5 );
		break;

	case ZKN2UI_SEARCH_ROW_ENTER:	// 06: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_ROW_END );

	case ZKN2UI_SEARCH_ROW_CANCEL:	// 07: やめる
	case CURSORMOVE_CANCEL:			// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_ROW] = wk->search_cpy[0];
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_ROW_END );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_ROW_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・並び順終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchRowEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 0, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・名前選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchNameInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_NAME];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_NAME, 0, ZKN2SEQ_MAINSEQ_SEARCH_NAME_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・名前選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchNameMain( ZKN2_WORK * wk )
{
	u32 ret = ZKN2UI_SearchNameMain( wk );

	switch( ret ){
	case CURSORMOVE_CURSOR_ON:		// カーソル表示
	case CURSORMOVE_CURSOR_MOVE:	// 移動
	case CURSORMOVE_NONE:			// 動作なし
		break;

	case ZKN2UI_SEARCH_NAME_ENTER:		// 45: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_NAME_END );

	case ZKN2UI_SEARCH_NAME_CANCEL:		// 46: やめる
	case CURSORMOVE_CANCEL:				// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_NAME] = wk->search_cpy[0];
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_NAME_END );

	default:
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchNameSelect( wk, ret );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_NAME_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・名前選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchNameEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 1, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・タイプ選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchTypeInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_TYPE1];
	wk->search_cpy[1] = wk->search_prm[ZKN2_SEARCH_PRM_TYPE2];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_TYPE, 0, ZKN2SEQ_MAINSEQ_SEARCH_TYPE_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・タイプ選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchTypeMain( ZKN2_WORK * wk )
{
	u32	ret = ZKN2UI_SearchTypeMain( wk );

	switch( ret ){
	case CURSORMOVE_CURSOR_ON:		// カーソル表示
	case CURSORMOVE_CURSOR_MOVE:	// 移動
	case CURSORMOVE_NONE:			// 動作なし
		break;

	case ZKN2UI_SEARCH_TYPE_ENTER:	// 18: けってい
		if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] == wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] ){
			wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] = ZKN2LIST_SEARCH_DEF_TYPE;
		}
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_TYPE_END );

	case ZKN2UI_SEARCH_TYPE_CANCEL:	// 19: やめる
	case CURSORMOVE_CANCEL:			// キャンセル
		wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] = wk->search_cpy[0];
		wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] = wk->search_cpy[1];
		Snd_SePlay( SE_ZKN2_CANCEL );
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_TYPE_END );
	default:
		if( ret == ZKN2LIST_SEARCH_DEF_TYPE ){
			if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] != ZKN2LIST_SEARCH_DEF_TYPE ){
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] = ret;
			}else{
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] = ret;
			}
		}else{
			if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] == ZKN2LIST_SEARCH_DEF_TYPE ){
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] = ret;
			}else if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] == ZKN2LIST_SEARCH_DEF_TYPE ){
				if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] == ret ){ break; }
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] = ret;
			}else{
				if( wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] == ret ){ break; }
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE1] = wk->search_prm[ZKN2_SEARCH_PRM_TYPE2];
				wk->search_prm[ZKN2_SEARCH_PRM_TYPE2] = ret;
			}
		}
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchTypeSelect( wk );
		ZKN2BMP_SearchSelectTypePut(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_TYPE1], ZKN2_BMPWIN_SEARCH_TYPE_SEL1 );
		ZKN2BMP_SearchSelectTypePut(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_TYPE2], ZKN2_BMPWIN_SEARCH_TYPE_SEL2 );
		GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_TYPE_SEL1] );
		GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_TYPE_SEL2] );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_TYPE_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・タイプ選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchTypeEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 2, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L];
	wk->search_cpy[1] = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_HEIGHT, 0, ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightMain( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	switch( ZKN2UI_SearchHeightMain(wk) ){
	case ZKN2UI_SEARCH_HEIGHT_MAX_CUR:		// 00: MAX
		swk->tmp = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H];
		swk->rep_cnt = 0;
		ZKN2OBJ_SearchMaxMinMove( wk, 0, ZKN2_OBJ_SEARCH_MAX_CUR, TRUE );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAX_TOUCH;

	case ZKN2UI_SEARCH_HEIGHT_MIN_CUR:		// 01: MIN
		swk->tmp = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L];
		swk->rep_cnt = 0;
		ZKN2OBJ_SearchMaxMinMove( wk, 0, ZKN2_OBJ_SEARCH_MIN_CUR, TRUE );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MIN_TOUCH;

	case ZKN2UI_SEARCH_HEIGHT_ENTER:	// 02: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_END );

	case ZKN2UI_SEARCH_HEIGHT_CANCEL:	// 03: やめる
	case CURSORMOVE_CANCEL:				// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] = wk->search_cpy[0];
		wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] = wk->search_cpy[1];
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_END );

	case ZKN2UI_SEARCH_HEIGHT_P_MAX:	// 04: MAX+
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] != ZKN2_HW_DOT_MAX ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MAX_RA;
			swk->mv  = 1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_R_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAX_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_HEIGHT_M_MAX:	// 05: MAX-
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] > wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MAX_LA;
			swk->mv  = -1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_L_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAX_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_HEIGHT_P_MIN:	// 06: MIN+
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] < wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MIN_RA;
			swk->mv  = 1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_R_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MIN_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_HEIGHT_M_MIN:	// 07: MIN-
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] != 0 ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MIN_LA;
			swk->mv  = -1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_L_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MIN_MOVE_ONE;
		}
		break;

	case CURSORMOVE_NONE:
		if( !( sys.cont & PAD_KEY_LEFT ) && !( sys.cont & PAD_KEY_RIGHT ) && GF_TP_GetCont() == FALSE ){
			swk->rep_cnt = 0;
		}
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * 高さ/重さパラメータを加減算
 *
 * @param	wk		図鑑画面ワーク
 * @param	min		最小値
 * @param	max		最大値
 * @param	cnt		動作カウンタ
 * @param	mv		移動方向
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void SearchHWParamInc( u32 * prm, s32 min, s32 max, u32 * cnt, s32 mv )
{
	s32	cpy, inc;

	if( *cnt != SEARCH_HEIGHTWEIGHT_REPCNT_MAX ){
		*cnt += 1;
	}

	if( *cnt >= SEARCH_HEIGHTWEIGHT_REPCNT3 ){
		inc = 32;
	}else if( *cnt >= SEARCH_HEIGHTWEIGHT_REPCNT2 ){
		inc = 16;
	}else if( *cnt >= SEARCH_HEIGHTWEIGHT_REPCNT1 ){
		inc = 8;
	}else{
		inc = 1;
	}

	cpy = *prm;
	cpy += ( inc * mv );

	if( cpy < min ){
		cpy = min;
	}else if( cpy > max ){
		cpy = max;
	}
	*prm = cpy;
}

//--------------------------------------------------------------------------------------------
/**
 * 高さ/重さ変更バーを移動
 *
 * @param	wk		図鑑画面ワーク
 * @param	prm		現在の検索値
 * @param	mode	高さ or 重さ
 * @param	objID	OBJ ID
 * @param	bmpID	BMPWIN ID
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void SearchHWBarMovePos( ZKN2_WORK * wk, u32 prm, u32 mode, u32 obj_id, u32 bmp_id )
{
	u32	x;

	x = ZKN2OBJ_SearchMaxMinPosGet( wk, prm );
	ZKN2OBJ_SearchMaxMinMove( wk, x, obj_id, TRUE );
	if( mode == ZKN2OBJ_SEARCH_SIZMODE_HEIGHT ){
		ZKN2OBJ_SearchMaxMinNumChange( wk, obj_id+1, wk->hw_dot[prm].height );
		ZKN2BMP_SearchSelectNumPut( wk, wk->hw_dot[prm].height, bmp_id );
		GF_BGL_BmpWinOnVReq( &wk->win[bmp_id] );
	}else{
		ZKN2OBJ_SearchMaxMinNumChange( wk, obj_id+1, wk->hw_dot[prm].weight );
		ZKN2BMP_SearchSelectNumPut( wk, wk->hw_dot[prm].weight, bmp_id );
		GF_BGL_BmpWinOnVReq( &wk->win[bmp_id] );
	}
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 3, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択最大値変更バータッチ処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightMaxTouch( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk;
	u32	tpx;
	u32	tmp;

	swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2UI_HeightWeightAreaCheck( &tpx ) == FALSE ){
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] < wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] ){
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] = swk->tmp;
		}
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H],
			ZKN2OBJ_SEARCH_SIZMODE_HEIGHT, ZKN2_OBJ_SEARCH_MAX_CUR, ZKN2_BMPWIN_SEARCH_HEIGHT_H );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN;
	}

	tmp = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H];

	// バー移動
	ZKN2OBJ_SearchMaxMinMove( wk, tpx, ZKN2_OBJ_SEARCH_MAX_CUR, TRUE );
	// バーの位置取得
	wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] = ZKN2OBJ_SearchPosMaxMinGet( wk, ZKN2_OBJ_SEARCH_MAX_CUR );
	// バーの数字OBJ変更
	ZKN2OBJ_SearchMaxMinNumChange(
		wk,
		ZKN2_OBJ_SEARCH_MAX_NUM1,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H]].height );
	// ＢＭＰ数字変更
	ZKN2BMP_SearchSelectNumPut(
		wk,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H]].height,
		ZKN2_BMPWIN_SEARCH_HEIGHT_H );
	GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_HEIGHT_H] );
	// 矢印変更
	ZKN2OBJ_SearchMaxMinArrowCahnge(
		wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );

	if( tmp != wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] ){
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAX_TOUCH;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択最小値変更バータッチ処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightMinTouch( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk;
	u32	tpx;
	u32	tmp;

	swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2UI_HeightWeightAreaCheck( &tpx ) == FALSE ){
		if( wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] > wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H] ){
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] = swk->tmp;
		}
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L],
			ZKN2OBJ_SEARCH_SIZMODE_HEIGHT, ZKN2_OBJ_SEARCH_MIN_CUR, ZKN2_BMPWIN_SEARCH_HEIGHT_L );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN;
	}

	tmp = wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L];

	// バー移動
	ZKN2OBJ_SearchMaxMinMove( wk, tpx, ZKN2_OBJ_SEARCH_MIN_CUR, TRUE );
	// バーの位置取得
	wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] = ZKN2OBJ_SearchPosMaxMinGet( wk, ZKN2_OBJ_SEARCH_MIN_CUR );
	// バーの数字OBJ変更
	ZKN2OBJ_SearchMaxMinNumChange(
		wk,
		ZKN2_OBJ_SEARCH_MIN_NUM1,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L]].height );
	// ＢＭＰ数字変更
	ZKN2BMP_SearchSelectNumPut(
		wk,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L]].height,
		ZKN2_BMPWIN_SEARCH_HEIGHT_L );
	GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_HEIGHT_L] );
	// 矢印変更
	ZKN2OBJ_SearchMaxMinArrowCahnge(
		wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );

	if( tmp != wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L] ){
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MIN_TOUCH;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択単発最大値変更処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightMaxMoveOne( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2OBJ_AnmGet( wk, swk->obj ) == FALSE ){
		SearchHWParamInc(
			&wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H],
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L],
			ZKN2_HW_DOT_MAX,
			&swk->rep_cnt, swk->mv );
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H],
			ZKN2OBJ_SEARCH_SIZMODE_HEIGHT, ZKN2_OBJ_SEARCH_MAX_CUR, ZKN2_BMPWIN_SEARCH_HEIGHT_H );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAX_MOVE_ONE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・高さ選択単発最小値変更処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchHeightMinMoveOne( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2OBJ_AnmGet( wk, swk->obj ) == FALSE ){
		SearchHWParamInc(
			&wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L],
			0,
			wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_H],
			&swk->rep_cnt, swk->mv );
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L],
			ZKN2OBJ_SEARCH_SIZMODE_HEIGHT, ZKN2_OBJ_SEARCH_MIN_CUR, ZKN2_BMPWIN_SEARCH_HEIGHT_L );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_HEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_HEIGHT_MIN_MOVE_ONE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L];
	wk->search_cpy[1] = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_WEIGHT, 0, ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightMain( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	switch( ZKN2UI_SearchWeightMain(wk) ){
	case ZKN2UI_SEARCH_WEIGHT_MAX_CUR:		// 00: MAX
		swk->tmp = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H];
		swk->rep_cnt = 0;
		ZKN2OBJ_SearchMaxMinMove( wk, 0, ZKN2_OBJ_SEARCH_MAX_CUR, TRUE );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAX_TOUCH;

	case ZKN2UI_SEARCH_WEIGHT_MIN_CUR:		// 01: MIN
		swk->tmp = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L];
		swk->rep_cnt = 0;
		ZKN2OBJ_SearchMaxMinMove( wk, 0, ZKN2_OBJ_SEARCH_MIN_CUR, TRUE );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MIN_TOUCH;

	case ZKN2UI_SEARCH_WEIGHT_ENTER:	// 02: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_END );

	case ZKN2UI_SEARCH_WEIGHT_CANCEL:	// 03: やめる
	case CURSORMOVE_CANCEL:				// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] = wk->search_cpy[0];
		wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] = wk->search_cpy[1];
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_END );

	case ZKN2UI_SEARCH_WEIGHT_P_MAX:	// 04: MAX+
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] != ZKN2_HW_DOT_MAX ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MAX_RA;
			swk->mv  = 1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_R_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAX_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_WEIGHT_M_MAX:	// 05: MAX-
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] > wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MAX_LA;
			swk->mv  = -1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_L_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAX_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_WEIGHT_P_MIN:	// 06: MIN+
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] < wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MIN_RA;
			swk->mv  = 1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_R_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MIN_MOVE_ONE;
		}
		break;

	case ZKN2UI_SEARCH_WEIGHT_M_MIN:	// 07: MIN-
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] != 0 ){
			if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
				Snd_SePlay( SE_ZKN2_DECIDE );
			}else{
				Snd_SePlay( SE_ZKN2_BUTTON );
			}
			swk->obj = ZKN2_OBJ_SEARCH_MIN_LA;
			swk->mv  = -1;
			ZKN2OBJ_AnmSet( wk, swk->obj, ZKN2OBJ_M_ANM_OMOSA_L_TOUCH );
			return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MIN_MOVE_ONE;
		}
		break;

	case CURSORMOVE_NONE:
		if( !( sys.cont & PAD_KEY_LEFT ) && !( sys.cont & PAD_KEY_RIGHT ) && GF_TP_GetCont() == FALSE ){
			swk->rep_cnt = 0;
		}
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 4, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択最大値変更バータッチ処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightMaxTouch( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk;
	u32	tpx;
	u32	tmp;

	swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2UI_HeightWeightAreaCheck( &tpx ) == FALSE ){
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] < wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] ){
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] = swk->tmp;
		}
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H],
			ZKN2OBJ_SEARCH_SIZMODE_WEIGHT, ZKN2_OBJ_SEARCH_MAX_CUR, ZKN2_BMPWIN_SEARCH_WEIGHT_H );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN;
	}

	tmp = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H];

	// バー移動
	ZKN2OBJ_SearchMaxMinMove( wk, tpx, ZKN2_OBJ_SEARCH_MAX_CUR, TRUE );
	// バーの位置取得
	wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] = ZKN2OBJ_SearchPosMaxMinGet( wk, ZKN2_OBJ_SEARCH_MAX_CUR );
	// バーの数字OBJ変更
	ZKN2OBJ_SearchMaxMinNumChange(
		wk,
		ZKN2_OBJ_SEARCH_MAX_NUM1,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H]].weight );
	// ＢＭＰ数字変更
	ZKN2BMP_SearchSelectNumPut(
		wk,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H]].weight,
		ZKN2_BMPWIN_SEARCH_WEIGHT_H );
	GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_WEIGHT_H] );
	// 矢印変更
	ZKN2OBJ_SearchMaxMinArrowCahnge(
		wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );

	if( tmp != wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] ){
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAX_TOUCH;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択最小値変更バータッチ処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightMinTouch( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk;
	u32	tpx;
	u32	tmp;

	swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2UI_HeightWeightAreaCheck( &tpx ) == FALSE ){
		if( wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] > wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H] ){
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] = swk->tmp;
		}
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L],
			ZKN2OBJ_SEARCH_SIZMODE_WEIGHT, ZKN2_OBJ_SEARCH_MIN_CUR, ZKN2_BMPWIN_SEARCH_WEIGHT_L );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN;
	}

	tmp = wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L];

	// バー移動
	ZKN2OBJ_SearchMaxMinMove( wk, tpx, ZKN2_OBJ_SEARCH_MIN_CUR, TRUE );
	// バーの位置取得
	wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] = ZKN2OBJ_SearchPosMaxMinGet( wk, ZKN2_OBJ_SEARCH_MIN_CUR );
	// バーの数字OBJ変更
	ZKN2OBJ_SearchMaxMinNumChange(
		wk,
		ZKN2_OBJ_SEARCH_MIN_NUM1,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L]].weight );
	// ＢＭＰ数字変更
	ZKN2BMP_SearchSelectNumPut(
		wk,
		wk->hw_dot[wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L]].weight,
		ZKN2_BMPWIN_SEARCH_WEIGHT_L );
	GF_BGL_BmpWinOnVReq( &wk->win[ZKN2_BMPWIN_SEARCH_WEIGHT_L] );
	// 矢印変更
	ZKN2OBJ_SearchMaxMinArrowCahnge(
		wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );

	if( tmp != wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L] ){
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MIN_TOUCH;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択単発最大値変更処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightMaxMoveOne( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2OBJ_AnmGet( wk, swk->obj ) == FALSE ){
		SearchHWParamInc(
			&wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H],
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L],
			ZKN2_HW_DOT_MAX,
			&swk->rep_cnt, swk->mv );
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H],
			ZKN2OBJ_SEARCH_SIZMODE_WEIGHT, ZKN2_OBJ_SEARCH_MAX_CUR, ZKN2_BMPWIN_SEARCH_WEIGHT_H );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H], ZKN2_OBJ_SEARCH_MAX_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAX_MOVE_ONE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・重さ選択単発最小値変更処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchWeightMinMoveOne( ZKN2_WORK * wk )
{
	SEARCH_HEIGHTWEIGHT_WORK * swk = (SEARCH_HEIGHTWEIGHT_WORK *)wk->seq_work;

	if( ZKN2OBJ_AnmGet( wk, swk->obj ) == FALSE ){
		SearchHWParamInc(
			&wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L],
			0,
			wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_H],
			&swk->rep_cnt, swk->mv );
		SearchHWBarMovePos(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L],
			ZKN2OBJ_SEARCH_SIZMODE_WEIGHT, ZKN2_OBJ_SEARCH_MIN_CUR, ZKN2_BMPWIN_SEARCH_WEIGHT_L );
		ZKN2OBJ_SearchMaxMinArrowCahnge(
			wk, wk->search_prm[ZKN2_SEARCH_PRM_WEIGHT_L], ZKN2_OBJ_SEARCH_MIN_LA );
		return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_WEIGHT_MIN_MOVE_ONE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・地域選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchAreaInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_AREA];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_AREA, 0, ZKN2SEQ_MAINSEQ_SEARCH_AREA_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・地域選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchAreaMain( ZKN2_WORK * wk )
{
	u32	ret = ZKN2UI_SearchAreaMain( wk );

	switch( ret ){
	case CURSORMOVE_CURSOR_ON:		// カーソル表示
	case CURSORMOVE_CURSOR_MOVE:	// 移動
	case CURSORMOVE_NONE:			// 動作なし
		break;

	case ZKN2UI_SEARCH_AREA_ENTER:		// 04: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_AREA_END );

	case ZKN2UI_SEARCH_AREA_CANCEL:		// 05: やめる
	case CURSORMOVE_CANCEL:				// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_AREA] = wk->search_cpy[0];
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_AREA_END );

	default:
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchAreaSelect( wk, ret );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_AREA_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・地域選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchAreaEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 5, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・形選択初期処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchFormInit( ZKN2_WORK * wk )
{
	wk->search_cpy[0] = wk->search_prm[ZKN2_SEARCH_PRM_FORM];
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_FORM, 0, ZKN2SEQ_MAINSEQ_SEARCH_FORM_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・形選択メイン処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchFormMain( ZKN2_WORK * wk )
{
	u32	ret = ZKN2UI_SearchFormMain( wk );

	switch( ret ){
	case CURSORMOVE_CURSOR_ON:		// カーソル表示
	case CURSORMOVE_CURSOR_MOVE:	// 移動
	case CURSORMOVE_NONE:			// 動作なし
		break;

	case ZKN2UI_SEARCH_FORM_ENTER:		// 15: けってい
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_ENTER_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_FORM_END );

	case ZKN2UI_SEARCH_FORM_CANCEL:		// 16: やめる
	case CURSORMOVE_CANCEL:				// キャンセル
		Snd_SePlay( SE_ZKN2_CANCEL );
		wk->search_prm[ZKN2_SEARCH_PRM_FORM] = wk->search_cpy[0];
		return SearchMainButtonAnmSet(
					wk,
					SEARCHINPUT_BUTTON_CANCEL_PX,
					SEARCHINPUT_BUTTON_SX,
					ZKN2SEQ_MAINSEQ_SEARCH_FORM_END );

	default:
		if( KeyTouchStatus_CheckTouchOrKey( wk->dat->kt_status ) == APP_END_KEY ){
			Snd_SePlay( SE_ZKN2_DECIDE );
		}else{
			Snd_SePlay( SE_ZKN2_BUTTON );
		}
		ZKN2MAIN_SearchFormSelect( wk, ret );
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_FORM_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・形選択終了処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchFormEnd( ZKN2_WORK * wk )
{
	SearchInputWorkSet( wk, ZKN2MAIN_SEARCHINIT_MAIN, 6, ZKN2SEQ_MAINSEQ_SEARCH_MAIN );
	return ZKN2SEQ_MAINSEQ_SEARCH_INPUT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リスト選択
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchListMain( ZKN2_WORK * wk )
{
	switch( ZKN2UI_SearchListMain( wk, FALSE ) ){
	case ZKN2UI_LIST_MOVE:		// ポケモン切り替え
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_SEARCH_CURSOR );
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		break;

	case ZKN2UI_LIST_SUARCH:	// 探す
		return ListButtonAnmSet( wk, 0, 8, ZKN2SEQ_MAINSEQ_SEARCH_RETURN_INPUT );

	case ZKN2UI_LIST_VOICE:		// 鳴き声
		if( ZKN2LIST_SelPosGet( wk ) != 0 ){
			if( PokeVoicePlay( wk ) == TRUE ){
				return ListButtonAnmSet( wk, 8, 8, ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN );
			}
		}
		break;

	case ZKN2UI_LIST_INFO:		// 詳しく
		if( ZKN2LIST_SelPosGet( wk ) != 0 && ZKN2LIST_SelMonsGet( wk ) != 0 ){
			Snd_SePlay( SE_ZKN2_DECIDE );
			wk->page = ZKN_PAGE_PLACE;
			return ListButtonAnmSet( wk, 16, 8, ZKN2SEQ_MAINSEQ_SEARCH_DETAIL_SET );
		}
		break;

	case ZKN2UI_LIST_CANCEL:	// やめる
		return ListButtonAnmSet( wk, 24, 8, ZKN2SEQ_MAINSEQ_SEARCH_LIST_END );

	case ZKN2UI_LIST_CANCEL_BUTTON:	// やめる（ボタン）
		return ListButtonAnmSet( wk, 24, 8, ZKN2SEQ_MAINSEQ_SEARCH_LIST_END );

	case ZKN2UI_LIST_ARROW_L:	// 表示言語切り替え（左）
		ZKN2MAIN_SearchLangChange( wk, ZKN2LIST_SelMonsGet(wk), -1 );
		break;

	case ZKN2UI_LIST_ARROW_R:	// 表示言語切り替え（右）
		ZKN2MAIN_SearchLangChange( wk, ZKN2LIST_SelMonsGet(wk), 1 );
		break;

	case ZKN2UI_LIST_ARROW_U:	// ポケモンスクロール（上）
		if( wk->list_scr != 0 ){
#ifdef	GS_AFTERMASTER_GF1061_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_U;
		}
		break;

	case ZKN2UI_LIST_ARROW_U_KEY:	// ポケモンスクロール（上：キー）
		if( wk->list_scr != 0 ){
			LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;
#ifdef	GS_AFTERMASTER_GF1061_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			swk->key = 1;
			return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_U;
		}
		break;

	case ZKN2UI_LIST_ARROW_D:	// ポケモンスクロール（下）
		if( ( wk->list_scr + 1 ) <= ZKN2LIST_ListScrollMaxGet(wk,FALSE) ){
#ifdef	GS_AFTERMASTER_GF1061_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_D;
		}
		break;

	case ZKN2UI_LIST_ARROW_D_KEY:	// ポケモンスクロール（下：キー）
		if( ( wk->list_scr + 1 ) <= ZKN2LIST_ListScrollMaxGet(wk,FALSE) ){
			LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;
#ifdef	GS_AFTERMASTER_GF1061_20091009_FIX
			Snd_SePlay( SE_ZKN2_BUTTON );
#else
			Snd_SePlay( SE_ZKN2_SELECT );
#endif
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			swk->key = 1;
			return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_D;
		}
		break;

	case ZKN2UI_LIST_RAIL:		// ポケモンスクロール（フリー）
		{
			u32	x, y;
			GF_TP_GetPointCont( &x, &y );
			if( ZKN2OBJ_ListBarCheck( wk, ZKN2_OBJ_SEARCH_BAR, x, y ) == TRUE ){
				return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_BAR;
			}else{
				LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;
				swk->x = x;
				swk->y = y;
				return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_RAIL;
			}
		}
		break;


	default:
		break;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リストスクロール（番号減少）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchScroll_U( ZKN2_WORK * wk )
{
	LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_ARROW_U, ZKN2OBJ_M_ANM_UP_TOUCH );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_SEARCH_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_SEARCH_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_SEARCH_LABEL_POKE] );
		swk->scrn   = ZKN2MAIN_SearchListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*(wk->list_scr-1) );
		swk->bar_my = ZKN2OBJ_ListBarAotoMoveCntGet(
						wk, ZKN2_OBJ_SEARCH_BAR,
						ZKN2OBJ_ListBarPosYGet(wk,wk->list_scr-1,ZKN2_OBJ_SEARCH_BAR,FALSE),
						LIST_SCROLL_MAX );
		if( wk->list_scr == 1 ){
			ZKN2OBJ_SearchListIconMoveUInit( wk );
		}
		swk->seq++;
	case 1:
		swk->cnt++;
		ZKN2MAIN_ListBgScrollPut(
			wk,
			&swk->scrn[ 32*5*ZKN2_POKEICON_SEL_V_MAX - 32*LIST_SCROLL_SPD*swk->cnt] );
		ZKN2OBJ_PokeIconScroll_U( wk, ZKN2_OBJ_SEARCH_POKEICON, LIST_SCROLL_OBJ_SPD, swk->cnt / 5 );
		ZKN2OBJ_ListBarAotoMove( wk, ZKN2_OBJ_SEARCH_BAR, -swk->bar_my );

		if( wk->list_scr == 1 ){
			ZKN2OBJ_SearchListIconMove( wk, 8 );
		}

		if( swk->cnt == LIST_SCROLL_MAX ){
			swk->seq++;
		}
		break;

	case 2:
		if( swk->key == 1 ){
			wk->list_pos += ( ZKN2_POKEICON_PUT_H_MAX * 2);
		}
		wk->list_scr--;
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_SEARCH_CURSOR );
		ZKN2MAIN_ListBgScreenExit( swk->scrn );
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, FALSE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_U;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リストスクロール（番号増加）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchScroll_D( ZKN2_WORK * wk )
{
	LIST_SCROLL_WORK * swk = (LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_ARROW_D, ZKN2OBJ_M_ANM_DOWN_TOUCH );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_SEARCH_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_SEARCH_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_SEARCH_LABEL_POKE] );
		swk->scrn   = ZKN2MAIN_SearchListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		swk->bar_my = ZKN2OBJ_ListBarAotoMoveCntGet(
						wk, ZKN2_OBJ_SEARCH_BAR,
						ZKN2OBJ_ListBarPosYGet(wk,wk->list_scr+1,ZKN2_OBJ_SEARCH_BAR,FALSE),
						LIST_SCROLL_MAX );
		swk->seq++;
	case 1:
		swk->cnt++;
		ZKN2MAIN_ListBgScrollPut(
			wk,
			&swk->scrn[ 32*LIST_SCROLL_SPD*swk->cnt ] );
		ZKN2OBJ_PokeIconScroll_D( wk, ZKN2_OBJ_SEARCH_POKEICON, -LIST_SCROLL_OBJ_SPD, swk->cnt / 5 );
		ZKN2OBJ_ListBarAotoMove( wk, ZKN2_OBJ_SEARCH_BAR, swk->bar_my );

		if( wk->list_scr == 0 ){
			ZKN2OBJ_SearchListIconMove( wk, -8 );
		}

		if( swk->cnt == LIST_SCROLL_MAX ){
			swk->seq++;
		}
		break;

	case 2:
		if( swk->key == 1 ){
			wk->list_pos -= ( ZKN2_POKEICON_PUT_H_MAX * 2);
		}
		wk->list_scr++;
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_SEARCH_CURSOR );
		ZKN2MAIN_ListBgScreenExit( swk->scrn );
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, FALSE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_D;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リストスクロール（バー）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchScroll_Bar( ZKN2_WORK * wk )
{
	u32	x, y;

	if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
		return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
	}
	if( ZKN2OBJ_ListBarMove( wk, ZKN2_OBJ_SEARCH_BAR, x, y, FALSE ) == TRUE ){
		u16 * scrn = ZKN2MAIN_SearchListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		wk->icon_swap ^= 1;
		ZKN2MAIN_ListBgScrollPut( wk, scrn );
		ZKN2MAIN_ListBgScreenExit( scrn );
		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_SEARCH_POKEICON );
		if( wk->list_scr == 0 ){
			ZKN2OBJ_SearchListIconDefPosSet( wk );
		}else{
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_LISTICON, FALSE );
		}
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, FALSE );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}
	return ZKN2SEQ_MAINSEQ_SEARCH_SCROLL_BAR;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リストスクロール（レール）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchScroll_Rail( ZKN2_WORK * wk )
{
	LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;

	if( ZKN2OBJ_ListBarMove( wk, ZKN2_OBJ_SEARCH_BAR, swk->x, swk->y, FALSE ) == TRUE ){
		u16 * scrn = ZKN2MAIN_SearchListBgScreenMake( wk, ZKN2_POKEICON_SEL_MAX*wk->list_scr );
		wk->icon_swap ^= 1;
		ZKN2MAIN_ListBgScrollPut( wk, scrn );
		ZKN2MAIN_ListBgScreenExit( scrn );
		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_SEARCH_POKEICON );
		if( wk->list_scr == 0 ){
			ZKN2OBJ_SearchListIconDefPosSet( wk );
		}else{
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_LISTICON, FALSE );
		}
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, TRUE );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
	}
	return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リストから条件入力へ戻る
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchReturnInput( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
#if GS_AFTERMASTER_SYSTEM1619_20091016_FIX
		{
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			if( mons != 0 ){
				ZUKANPARAM_Set( wk->dat->zkn_param, mons, wk->zkn_mode );
			}
		}
		ZKN2LIST_MonsListTblMake(
			wk, wk->zkn_mode,
			ZKN2LIST_SORT_NORMAL,			// ポケモンナンバー
			ZKN2LIST_SEARCH_NAME_NONE,		// 名前
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			0,								// 高さ（低）
			ZKN2_HW_DOT_MAX,				// 高さ（高）
			0,								// 重さ（低）
			ZKN2_HW_DOT_MAX,				// 重さ（高）
			ZKN2LIST_SEARCH_AREA_MASK_NONE,	// 地域
			ZKN2LIST_SEARCH_FORM_NONE );	// 形
		ZKN2LIST_ListPutMake( wk, TRUE );
		DefaultListPosSet( wk );
#endif
#if GS_AFTERMASTER_SYSTEM1652_20091027_FIX
		ListButtonOnOffSet( wk );
#endif
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_SEARCH_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_SEARCH_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_SEARCH_LABEL_POKE] );

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xfffe, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_RETURN_INPUT;

		ZKN2MAIN_SearchListButtonOutStart( wk );

		wk->seq_work[0]++;

		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_LIST ) == 0 ){
//			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_M, GF_BGL_SCROLL_X_SET, 0 );
//			GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, 0 );
			PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
			ZKN2BMP_Exit( wk );
			ZKN2OBJ_SearchPageListDelete( wk );
			ZKN2OBJ_SearchObjDelete( wk );
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_SEARCH_INIT;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_RETURN_INPUT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・結果リスト終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchListEnd( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		{
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			if( mons != 0 ){
				ZUKANPARAM_Set( wk->dat->zkn_param, mons, wk->zkn_mode );
			}
		}
		ZKN2LIST_MonsListTblMake(
			wk, wk->zkn_mode,
			ZKN2LIST_SORT_NORMAL,			// ポケモンナンバー
			ZKN2LIST_SEARCH_NAME_NONE,		// 名前
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
			0,								// 高さ（低）
			ZKN2_HW_DOT_MAX,				// 高さ（高）
			0,								// 重さ（低）
			ZKN2_HW_DOT_MAX,				// 重さ（高）
			ZKN2LIST_SEARCH_AREA_MASK_NONE,	// 地域
			ZKN2LIST_SEARCH_FORM_NONE );	// 形
		ZKN2LIST_ListPutMake( wk, TRUE );
		DefaultListPosSet( wk );

		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_top_m_lz_NCGR,
			wk->bgl, ZKN2_BGF_COVER_M, 0, 0, TRUE, HEAPID_ZUKAN );
		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_top_s_lz_NCGR,
			wk->bgl, ZKN2_BGF_COVER_S, 0, 0, TRUE, HEAPID_ZUKAN );
		ZKN2MAIN_ListCoverBGWFSet( wk );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_U, -36, 0 );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_D, -36, 0 );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_H, -4, 0 );
		BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_U, 2, 0, 18 );
		BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_D, 2, 0, 18 );
		BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_H, 2, 0, 18 );

		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_SEARCH_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_SEARCH_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_SEARCH_LABEL_POKE] );

		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
		ZKN2OBJ_SearchCoverSwithPut( wk );
//		ZKN2OBJ_CoverObjScroll( wk, ZKN2_OBJ_SEARCH_SWITCH, -COVER_OUT_SCROLL_CNT );

		ZKN2MAIN_SearchListButtonOutStart( wk );
		wk->seq_work[0]++;
//		break;

	case 1:
//		ZKN2OBJ_CoverObjMove( wk, ZKN2_OBJ_SEARCH_SWITCH, s16 px );
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_SEARCH_COVER_U ) == 0 ){
			wk->seq_work[0]++;
			break;
		}
		ZKN2OBJ_SearchCoverSwithMove( wk, 16 );
		break;

	case 2:
		wk->seq_work[0] = 0;
		ZKN2BMP_Exit( wk );
		ZKN2OBJ_SearchPageListDelete( wk );
		ZKN2OBJ_SearchObjDelete( wk );
//		PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );

		ZKN2MAIN_PageInit( wk, ZKN_PAGE_LIST );
//		PaletteDefaultTrans( wk->pfd, PF_BIT_NORMAL_ALL );
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_BTN_TOP );
		{
			COVER_MOVE_WORK * swk = (COVER_MOVE_WORK *)wk->seq_work;
			swk->seq = 1;
		}
		return ZKN2SEQ_MAINSEQ_TOP_COVER_OUT;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_LIST_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・詳細画面へ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchDetailSet( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		{
			u16	mons = ZKN2LIST_SelMonsGet( wk );
			if( mons != 0 ){
				ZUKANPARAM_Set( wk->dat->zkn_param, mons, wk->zkn_mode );
			}
		}
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_LABEL_LIST );
		ZKN2OBJ_LangArrowVanish( wk, ZKN2_OBJ_SEARCH_ARROW_L, FALSE );
		ZKN2OBJ_ListLangVanish( wk, ZKN2_OBJ_SEARCH_LANGICON_M, FALSE );
		GF_BGL_BmpWinOffVReq( &wk->win[ZKN2_BMPWIN_SEARCH_LABEL_POKE] );

		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, FALSE );
//		ZKN2OBJ_SearchCoverSwithPut( wk );

		ZKN2MAIN_SearchListButtonOutStart( wk );

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xfffe, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_DETAIL_SET;

		wk->seq_work[0]++;

		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_LIST ) == 0 ){
			wk->seq_work[0] = 0;
			ZKN2BMP_Exit( wk );
			ZKN2OBJ_SearchPageListDelete( wk );
			ZKN2OBJ_SearchObjDelete( wk );
			wk->detail_ret = ZKN_PAGE_SEARCH;
			return ZKN2SEQ_MAINSEQ_DETAIL_INIT;
		}
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_DETAIL_SET;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：検索画面・リストへ戻る
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SearchListRet( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_SEARCH );
//		ZKN2MAIN_SearchTopButtonInStart( wk );
//		ZKN2UI_SearchMainCursorMoveSet( wk, ZKN2UI_SEARCH_ROW );

		SaerchBGWFSet( wk, ZKN2_BGF_COVER_M, ZKN2_BGWF_SEARCH_BG_D1 );
		SaerchBGWFSet( wk, ZKN2_BGF_CENTER_M, ZKN2_BGWF_SEARCH_BG_D2 );
		SaerchBGWFSet( wk, ZKN2_BGF_COVER_M, ZKN2_BGWF_SEARCH_BG_U1 );
		SaerchBGWFSet( wk, ZKN2_BGF_CENTER_M, ZKN2_BGWF_SEARCH_BG_U2 );
		ZKN2BMP_SearchListSet( wk );

		ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_SEARCH_POKEICON );
		ZKN2MAIN_SearchListBgSet( wk );

		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_BAR, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_ARROW_U, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_ARROW_D, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_RAIL, TRUE );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_LISTICON, TRUE );
		ZKN2OBJ_ListBarAnmChg( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_SEARCH_BAR, FALSE );
		ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_SEARCH_ARROW_U, FALSE );

		ZKN2BMP_SearchInfoPut( wk, ZKN2BMP_SEARCH_INFO_ENTER );
		ZKN2OBJ_SearchFormSubMoveInit( wk );
		ZKN2OBJ_SearchFormSubMove( wk, -8*24 );
//		ZKN2MAIN_SearchSubWindowMask( TRUE );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D1, 0, 0 );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D2, 0, 0 );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U1, 0, 0 );
		BGWINFRM_FramePut( wk->wfrm, ZKN2_BGWF_SEARCH_BG_U2, 0, 0 );
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D1 );
		BGWINFRM_FrameOff( wk->wfrm, ZKN2_BGWF_SEARCH_BG_D2 );

		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_btn01_m_lz_NCGR,
			wk->bgl, ZKN2_BGF_CENTER_M, 0, 0, TRUE, HEAPID_ZUKAN );
		ArcUtil_HDL_BgCharSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_list_s_lz_NCGR,
			wk->bgl, ZKN2_BGF_UNDER_S, 0, 0, TRUE, HEAPID_ZUKAN );
		ArcUtil_HDL_ScrnSet(
			wk->graphic_ah, NARC_zukan_gra_zukan_gs_list01_s_lz_NSCR,
			wk->bgl, ZKN2_BGF_UNDER_S, 0, 0, TRUE, HEAPID_ZUKAN );
		ZKN2MAIN_SearchListButtonInStart( wk );
		ZKN2OBJ_SearchInputObjDelete( wk );

		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_SEARCH_CURSOR, TRUE );
		ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_SEARCH_CURSOR );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_SEARCH_CURSOR, ZKN2OBJ_M_ANM_LIST_CUR );
		ZKN2OBJ_SearchPageListLoad( wk );
		ZKN2MAIN_SearchSelPosInfoPut( wk );
		SearchListButtonOnOffSet( wk );
		ZKN2MAIN_ListLabelPut( wk );

		if( wk->list_scr != 0 ){
			ZKN2OBJ_SearchListIconMove( wk, -40 );
		}

		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xffef, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_SEARCH_LIST_RET;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_LIST ) == 0 ){
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_SEARCH_LIST_MAIN;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_SEARCH_LIST_RET;
}


//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
//	くわしく
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面ページ切り替え設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	start	現在のページ
 * @param	next	次のページ
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int DeteilEndSet( ZKN2_WORK * wk, u8 start, u8 next )
{
	DETAIL_END_WORK * swk;
	u8	px;

	swk = (DETAIL_END_WORK *)wk->seq_work;

	swk->seq   = 0;
	swk->start = start;

	if( next == 0xff ){
		ZKN2OBJ_DetailCursorPut( wk, 3 );
		return DetailButtonAnmPut( wk, 24, ZKN2SEQ_MAINSEQ_DETAIL_END );
	}

	if( next == ZKN_PAGE_PLACE ){
		px = 0;
		ZKN2OBJ_DetailCursorPut( wk, 0 );
	}else if( next == ZKN_PAGE_SIZE ){
		px = 8;
		ZKN2OBJ_DetailCursorPut( wk, 1 );
	}else if( next == ZKN_PAGE_FORM ){
		px = 16;
		ZKN2OBJ_DetailCursorPut( wk, 2 );
	}else{
		px = 24;
		ZKN2OBJ_DetailCursorPut( wk, 3 );
	}

	if( wk->page == ZKN_PAGE_PLACE ){
		wk->page = next;
		return DetailButtonAnmPut( wk, px, ZKN2SEQ_MAINSEQ_ENCOUNT_END );
	}
	if( wk->page == ZKN_PAGE_SIZE ){
		wk->page = next;
		return DetailButtonAnmPut( wk, px, ZKN2SEQ_MAINSEQ_SIZE_END );
	}
	if( wk->page == ZKN_PAGE_FORM ){
		wk->page = next;
		return DetailButtonAnmPut( wk, px, ZKN2SEQ_MAINSEQ_FORM_END );
	}
	wk->page = next;
	return DetailButtonAnmPut( wk, px, ZKN2SEQ_MAINSEQ_DETAIL_RET_END );
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：詳細画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_DetailInit( ZKN2_WORK * wk )
{
	wk->detail_mons = ZKN2LIST_SelMonsGet( wk );
//	wk->detail_page = DETAIL_PAGE_ENCOUNT;
	wk->detail_place_time = 0;
	wk->detail_place_pos = 0;
	wk->detail_place_mode = 0;
//	wk->detail_place_max = 0;

	ZKN2MAIN_DetailFormTblMake( wk );

	ZKN2MAIN_DetailButtonPalChange( wk );
	ZKN2MAIN_DetailButtonInStart( wk );

	ZKN2OBJ_DetailInit( wk );

	return MainSeq_EncountInit( wk );
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：詳細画面・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_DetailEnd( ZKN2_WORK * wk )
{
	DETAIL_END_WORK * swk = (DETAIL_END_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_DETAIL_CURSOR, FALSE );
		ZKN2MAIN_DetailButtonOutStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, 0, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ|PF_BIT_SUB_ALL, 0xffff, 0, swk->start, 16, 0 );
		swk->seq++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_DETAIL_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_DETAIL ) == 0 ){
			PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
			if( wk->page == ZKN_PAGE_FORM ){
				ZKN2BMP_FormPageExit( wk );
				ZKN2OBJ_FormPageDelete( wk );
			}else if( wk->page == ZKN_PAGE_SIZE ){
				ZKN2BMP_SizePageExit( wk );
				ZKN2OBJ_SizePageDelete( wk );
				ZKN2MAIN_SizePageBgChange( wk, FALSE );
			}else if( wk->page == ZKN_PAGE_PLACE ){
				ZKN2BMP_PlacePageExit( wk );
				ZKN2OBJ_PlacePageDelete( wk );
				ZKN2MAIN_EncountDataFree( wk );
				ZKN2MAIN_EncountGridDataFree( wk );
				EncountMapScrollDelete( wk );
			}else{
				ZKN2BMP_DetailRetPageExit( wk );
			}
			ZKN2OBJ_DetailDelete( wk );
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );

			wk->page = wk->detail_ret;
			if( wk->detail_ret == ZKN_PAGE_LIST ){
				return ZKN2SEQ_MAINSEQ_LIST_RETURN;
			}else{
				return ZKN2SEQ_MAINSEQ_SEARCH_LIST_RET;
			}
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_DETAIL_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountInit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		wk->detail_place_time = 0;
		wk->detail_place_mode = 0;
		wk->detail_place_pos  = 0;
		ZKN2MAIN_EncountGridDataLoad( wk );
		ZKN2MAIN_EncountDataLoad( wk, wk->detail_place_time, wk->detail_place_mode );
		ZKN2BMP_PlacePageBGWFSet( wk );
//		ZKN2OBJ_DetailCursorPut( wk, 0 );
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_PLACE );
		EncountModeSwitchChg( wk );
		EncountMapScrollInit( wk );
		ZKN2OBJ_PlacePosChange( wk );
		EncountPosAlphaInit( wk );
		if( wk->enc_data.all.num == 1 ){
			ZKN2MAIN_EncountWinPut( wk );
		}
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_ENCOUNT_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_DETAIL ) == 0 ){
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_DETAIL_CURSOR, TRUE );
			wk->page = ZKN_PAGE_PLACE;
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountMain( ZKN2_WORK * wk )
{
	BOOL touch;

	EncountPosAlpha( wk );

	switch( ZKN2UI_DetailEncountMain( wk, &touch ) ){
	case ZKN2UI_DETAIL_ENCOUNT_BTN:	//「ぶんぷ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DetailButtonAnmPut( wk, 0, ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN );

	case ZKN2UI_DETAIL_SIZE_BTN:	//「おおきさ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );

	case ZKN2UI_DETAIL_FORM_BTN:	//「すがた」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_FORM );

	case ZKN2UI_DETAIL_RET_BTN:		//「もどる」
		Snd_SePlay( SE_ZKN2_CANCEL );
		return DeteilEndSet( wk, 0, 0xff );

	case ZKN2UI_ENCOUNT_PLACE_U_2:	// 地名（２個上）
		if( PlaceListScrollSet( wk, -2, 2 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_U;
		}
		return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;

	case ZKN2UI_ENCOUNT_PLACE_U_1:	// 地名（１個上）
	case ZKN2UI_ENCOUNT_ARROW_U:	// 上矢印
		if( PlaceListScrollSet( wk, -1, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_U;
		}
		return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;

	case ZKN2UI_ENCOUNT_PLACE_D_2:	// 地名（２個下）
		if( PlaceListScrollSet( wk, 2, 2 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_D;
		}
		return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;

	case ZKN2UI_ENCOUNT_PLACE_D_1:	// 地名（１個下）
	case ZKN2UI_ENCOUNT_ARROW_D:	// 下矢印
		if( PlaceListScrollSet( wk, 1, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_D;
		}
		return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;

	case ZKN2UI_ENCOUNT_RAIL:		// レール
		{
			u32	x, y;
			GF_TP_GetPointCont( &x, &y );
			if( ZKN2OBJ_PlaceListBarCheck( wk, x, y ) == TRUE ){
				return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_BAR;
			}else{
				LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;
				swk->x = x;
				swk->y = y;
				return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_RAIL;
			}
		}
		break;

	case ZKN2UI_ENCOUNT_JOHTO:		//「ジョウト」
		if( EncountModeChange( wk, 0 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
		}
		break;

	case ZKN2UI_ENCOUNT_KANTO:		//「カントー」
		if( EncountModeChange( wk, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
		}
		break;

	case ZKN2UI_ENCOUNT_TIME1:		// 朝
		if( EncountTimeChange( wk, 0 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			ZKN2OBJ_PlaceTimeCursorMove( wk );
			return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
		}
		break;

	case ZKN2UI_ENCOUNT_TIME2:		// 昼
		if( EncountTimeChange( wk, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			ZKN2OBJ_PlaceTimeCursorMove( wk );
			return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
		}
		break;

	case ZKN2UI_ENCOUNT_TIME3:		// 夜
		if( EncountTimeChange( wk, 2 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			ZKN2OBJ_PlaceTimeCursorMove( wk );
			return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
		}
		break;

	case ZKN2UI_ENCOUNT_RETSET:		// 戻る処理へ
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_RETURN );
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountEnd( ZKN2_WORK * wk )
{
	DETAIL_END_WORK * swk = (DETAIL_END_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		swk->seq++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_ENCOUNT_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
//		PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
		ZKN2BMP_PlacePageExit( wk );
		ZKN2OBJ_PlacePageDelete( wk );
		ZKN2MAIN_EncountDataFree( wk );
		ZKN2MAIN_EncountGridDataFree( wk );
		EncountMapScrollDelete( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		if( wk->page == ZKN_PAGE_SIZE ){
			return ZKN2SEQ_MAINSEQ_SIZE_INIT;
		}else if( wk->page == ZKN_PAGE_FORM ){
			return ZKN2SEQ_MAINSEQ_FORM_INIT;
		}
		return ZKN2SEQ_MAINSEQ_DETAIL_RET_INIT;
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・地名切り替え（上）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountScroll_U( ZKN2_WORK * wk )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	u32	i;

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		wk->detail_place_pos--;
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_ENC_ARROW_U, ZKN2OBJ_M_ANM_UP_TOUCH );
		ZKN2BMP_PlaceNameMoveInit( wk, 1 );
		for( i=0; i<6; i++ ){
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_DETAIL_LIST1+i, 0, 1, 3 );
		}
		swk->bar_my = ZKN2OBJ_DetailListBarAotoMoveCntGet(
						wk,
						ZKN2_OBJ_ENC_BAR,
						ZKN2OBJ_PlaceListBarPosYGet(wk,wk->detail_place_pos),
						3 );
		swk->seq++;
	case 1:
		ZKN2OBJ_DetailListBarAotoMove( wk, ZKN2_OBJ_ENC_BAR, -swk->bar_my );
		swk->cnt++;
		if( swk->cnt == 3 ){
			swk->seq = 0;
			swk->cnt = 0;
			swk->mv--;
			if( swk->mv == 0 ){
				ZKN2OBJ_PlaceListBarPosYSet( wk );
				ZKN2OBJ_DetailListArrowAnmChange(
					wk, wk->detail_place_pos, wk->enc_data.all.num, ZKN2_OBJ_ENC_ARROW_U );
				ZKN2OBJ_PlacePosChange( wk );
				ZKN2OBJ_PlacePosOnOffChange( wk );
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
			}
		}
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_U;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・地名切り替え（下）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountScroll_D( ZKN2_WORK * wk )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	u32	i;

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		wk->detail_place_pos++;
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_ENC_ARROW_D, ZKN2OBJ_M_ANM_DOWN_TOUCH );
		ZKN2BMP_PlaceNameMoveInit( wk, -1 );
		for( i=0; i<6; i++ ){
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_DETAIL_LIST1+i, 0, -1, 3 );
		}
		swk->bar_my = ZKN2OBJ_DetailListBarAotoMoveCntGet(
						wk,
						ZKN2_OBJ_ENC_BAR,
						ZKN2OBJ_PlaceListBarPosYGet(wk,wk->detail_place_pos),
						3 );
		swk->seq++;
	case 1:
		ZKN2OBJ_DetailListBarAotoMove( wk, ZKN2_OBJ_ENC_BAR, swk->bar_my );
		swk->cnt++;
		if( swk->cnt == 3 ){
			swk->seq = 0;
			swk->cnt = 0;
			swk->mv--;
			if( swk->mv == 0 ){
				ZKN2OBJ_PlaceListBarPosYSet( wk );
				ZKN2OBJ_DetailListArrowAnmChange(
					wk, wk->detail_place_pos, wk->enc_data.all.num, ZKN2_OBJ_ENC_ARROW_U );
				ZKN2OBJ_PlacePosChange( wk );
				ZKN2OBJ_PlacePosOnOffChange( wk );
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
			}
		}
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_D;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・地名切り替え（バー）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountScroll_Bar( ZKN2_WORK * wk )
{
	u32	x, y;

#if	BTS_5503_FIX
	EncountPosAlpha( wk );
#endif

	if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
		return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
	}

	if( ZKN2OBJ_PlaceListBarMove( wk, x, y ) == TRUE ){
		ZKN2OBJ_DetailListArrowAnmChange(
			wk, wk->detail_place_pos, wk->enc_data.all.num, ZKN2_OBJ_ENC_ARROW_U );
		ZKN2OBJ_PlacePosChange( wk );
		ZKN2OBJ_PlacePosOnOffChange( wk );
		ZKN2BMP_PlaceListPutInit( wk );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_SCROLL_BAR;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・地名切り替え（レール）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountScroll_Rail( ZKN2_WORK * wk )
{
	LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;

	if( ZKN2OBJ_PlaceListBarMove( wk, swk->x, swk->y ) == TRUE ){
		ZKN2OBJ_DetailListArrowAnmChange(
			wk, wk->detail_place_pos, wk->enc_data.all.num, ZKN2_OBJ_ENC_ARROW_U );
		ZKN2OBJ_PlacePosChange( wk );
		ZKN2OBJ_PlacePosOnOffChange( wk );
		ZKN2BMP_PlaceListPutInit( wk );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：分布画面・分布データ切り替え
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EncountDataChange( ZKN2_WORK * wk )
{
	ENCDATA_CHG_WORK * swk;
	BOOL	scr;

	swk = (ENCDATA_CHG_WORK *)wk->seq_work;

	scr = EncountMapScroll( wk );

	switch( swk->seq ){
	case 0:
		ZKN2MAIN_EncountWinPut( wk );
		ZKN2MAIN_EncountWinOff( wk );
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_ENC_FACE, FALSE );
		ZKN2OBJ_PlacePosAllOff( wk );
		swk->seq++;

	case 1:
		swk->ev += 2;
		ZKN2MAIN_EncountDataChgSetBlendAlpha( 31-swk->ev, swk->ev );
		if( swk->ev == 16 ){
			swk->seq++;
		}
		break;

	case 2:
		// エンカウントデータ更新
		ZKN2MAIN_EncountDataFree( wk );
		ZKN2MAIN_EncountDataLoad( wk, wk->detail_place_time, wk->detail_place_mode );
		// リストＯＢＪ変更
		ZON2OBJ_EncountListBarInit( wk );
		// カーソル移動
//		ZKN2OBJ_PlaceTimeCursorMove( wk );
		// 上画面時間変更
		ZKN2BMP_PlaceTimePut( wk );
		// リスト更新
		ZKN2BMP_PlaceListPutInit( wk );
		// モード変更
		EncountModeSwitchChg( wk );
		swk->seq++;
		break;

	case 3:
		swk->ev -= 2;
		ZKN2MAIN_EncountDataChgSetBlendAlpha( 31-swk->ev, swk->ev );
		if( swk->ev == 0 ){
			ZKN2MAIN_SetBlendAlpha();
			swk->seq++;
		}
		break;

	case 4:
		if( scr == FALSE ){
			ZKN2OBJ_MyFacePut( wk );
			ZKN2OBJ_PlacePosChange( wk );
			EncountPosAlphaInit( wk );
			if( wk->enc_data.all.num == 1 ){
				ZKN2MAIN_EncountWinPut( wk );
			}
			MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
			return ZKN2SEQ_MAINSEQ_ENCOUNT_MAIN;
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_ENCOUNT_DATA_CHANGE;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：大きさ画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SizeInit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
//		ZKN2OBJ_DetailCursorPut( wk, 1 );
		ZKN2MAIN_SizePageBgChange( wk, TRUE );
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_SIZE );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_SIZE_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		wk->page = ZKN_PAGE_SIZE;
		wk->seq_work[0] = 0;
		return ZKN2SEQ_MAINSEQ_SIZE_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_SIZE_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：大きさ画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SizeMain( ZKN2_WORK * wk )
{
	BOOL touch;

	WeightAnime( wk );

	switch( ZKN2UI_DetailSizeMain( wk, &touch ) ){
	case ZKN2UI_DETAIL_ENCOUNT_BTN:	//「ぶんぷ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, ZKN_PAGE_PLACE );

	case ZKN2UI_DETAIL_SIZE_BTN:	//「おおきさ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );

	case ZKN2UI_DETAIL_FORM_BTN:	//「すがた」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, ZKN_PAGE_FORM );

	case ZKN2UI_DETAIL_RET_BTN:		//「もどる」
		Snd_SePlay( SE_ZKN2_CANCEL );
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, 0xff );
	}

	if( sys.trg & PAD_BUTTON_DECIDE ){
		Snd_SePlay( SE_ZKN2_SELECT );
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );
	}else if( GF_TP_GetTrg() == TRUE ){
		Snd_SePlay( SE_ZKN2_BUTTON );
		WeightAnimeWorkFree( wk );
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );
	}

	return ZKN2SEQ_MAINSEQ_SIZE_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：大きさ画面・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_SizeEnd( ZKN2_WORK * wk )
{
	DETAIL_END_WORK * swk = (DETAIL_END_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		swk->seq++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_SIZE_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
//		PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
		ZKN2BMP_SizePageExit( wk );
		ZKN2OBJ_SizePageDelete( wk );
		ZKN2MAIN_SizePageBgChange( wk, FALSE );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		if( wk->page == ZKN_PAGE_PLACE ){
			return ZKN2SEQ_MAINSEQ_ENCOUNT_INIT;
		}else if( wk->page == ZKN_PAGE_SIZE ){
			return ZKN2SEQ_MAINSEQ_SIZE_INIT;
		}else{
			return ZKN2SEQ_MAINSEQ_FORM_INIT;
		}
	}

	return ZKN2SEQ_MAINSEQ_SIZE_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormInit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		wk->detail_form_pos = 0;
		ZKN2BMP_FormPageBGWFSet( wk );
//		ZKN2OBJ_DetailCursorPut( wk, 2 );
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_FORM );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_FORM_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		wk->page = ZKN_PAGE_FORM;
		wk->seq_work[0] = 0;
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_FORM_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormMain( ZKN2_WORK * wk )
{
	BOOL touch;

	switch( ZKN2UI_DetailForm1Main( wk, &touch ) ){
	case ZKN2UI_DETAIL_ENCOUNT_BTN:	//「ぶんぷ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_PLACE );

	case ZKN2UI_DETAIL_SIZE_BTN:	//「おおきさ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );

	case ZKN2UI_DETAIL_FORM_BTN:	//「すがた」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DetailButtonAnmPut( wk, 16, ZKN2SEQ_MAINSEQ_FORM_MAIN );

	case ZKN2UI_DETAIL_RET_BTN:		//「もどる」
		Snd_SePlay( SE_ZKN2_CANCEL );
		return DeteilEndSet( wk, 0, 0xff );

	case ZKN2UI_FORM1_POKE_U_2:		// ポケモン名（２個上）
		if( FormListScrollSet( wk, -2, 2 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_FORM_SCROLL_U;
		}
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;

	case ZKN2UI_FORM1_POKE_U_1:		// ポケモン名（１個上）
	case ZKN2UI_FORM1_ARROW_U:		// 上矢印
		if( FormListScrollSet( wk, -1, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_FORM_SCROLL_U;
		}
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;

	case ZKN2UI_FORM1_POKE_D_2:		// ポケモン名（２個下）
		if( FormListScrollSet( wk, 2, 2 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_FORM_SCROLL_D;
		}
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;

	case ZKN2UI_FORM1_POKE_D_1:		// ポケモン名（１個下）
	case ZKN2UI_FORM1_ARROW_D:		// 下矢印
		if( FormListScrollSet( wk, 1, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			return ZKN2SEQ_MAINSEQ_FORM_SCROLL_D;
		}
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;


	case ZKN2UI_FORM1_RAIL:			// レール
		{
			u32	x, y;
			GF_TP_GetPointCont( &x, &y );
			if( ZKN2OBJ_FormListBarCheck( wk, x, y ) == TRUE ){
				return ZKN2SEQ_MAINSEQ_FORM_SCROLL_BAR;
			}else{
				LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;
				swk->x = x;
				swk->y = y;
				return ZKN2SEQ_MAINSEQ_FORM_SCROLL_RAIL;
			}
		}
		break;

	case ZKN2UI_FORM1_MIKURABERU:	//「みくらべる」
		if( wk->detail_form_max != 1 ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_DECIDE );
			}
			return FormButtonAnmPut( wk, ZKN2_BGF_COVER_M, 17, 17, 15, 2, ZKN2SEQ_MAINSEQ_FORM2_INIT );
		}
		break;

	case ZKN2UI_FORM1_RETSET:		// 戻る処理へ
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_RETURN );

	case ZKN2UI_NONE:				// 動作なし
		break;
	}

	return ZKN2SEQ_MAINSEQ_FORM_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormEnd( ZKN2_WORK * wk )
{
	DETAIL_END_WORK * swk = (DETAIL_END_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		swk->seq++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_FORM_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
//		PaletteAreaClear( PF_BIT_NORMAL_ALL, HEAPID_ZUKAN );
		ZKN2BMP_FormPageExit( wk );
		ZKN2OBJ_FormPageDelete( wk );
		swk->seq = 0;
		if( wk->page == ZKN_PAGE_PLACE ){
			return ZKN2SEQ_MAINSEQ_ENCOUNT_INIT;
		}else if( wk->page == ZKN_PAGE_SIZE ){
			return ZKN2SEQ_MAINSEQ_SIZE_INIT;
		}else{
			return ZKN2SEQ_MAINSEQ_DETAIL_RET_INIT;
		}
	}

	return ZKN2SEQ_MAINSEQ_FORM_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・フォルム切り替え（上）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormScroll_U( ZKN2_WORK * wk )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	u32	i;

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		wk->detail_form_pos--;
		ZKN2OBJ_FormPokeIconMoveInit( wk, 1 );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_FORM_ARROW_U, ZKN2OBJ_M_ANM_UP_TOUCH );
		ZKN2BMP_FormNameMoveInit( wk, 1 );
		for( i=0; i<6; i++ ){
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_DETAIL_LIST1+i, 0, 1, 3 );
		}
		swk->bar_my = ZKN2OBJ_DetailListBarAotoMoveCntGet(
						wk,
						ZKN2_OBJ_FORM_BAR,
						ZKN2OBJ_FormListBarPosYGet(wk,wk->detail_form_pos),
						3 );
		swk->seq++;
	case 1:
		ZKN2OBJ_FormPokeIconMove( wk, 8 );
		ZKN2OBJ_DetailListBarAotoMove( wk, ZKN2_OBJ_FORM_BAR, -swk->bar_my );
		swk->cnt++;
		if( swk->cnt == 3 ){
			swk->seq = 0;
			swk->cnt = 0;
			swk->mv--;
			if( swk->mv == 0 ){
				ZKN2OBJ_FormPage1PokeGraChange( wk, wk->detail_form_pos );
				ZKN2OBJ_FormListBarPosYSet( wk );
				ZKN2OBJ_DetailListArrowAnmChange(
					wk, wk->detail_form_pos, wk->detail_form_max, ZKN2_OBJ_FORM_ARROW_U );
				ZKN2BMP_FormNamePutU1( wk );
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_FORM_MAIN;
			}
		}
	}

	return ZKN2SEQ_MAINSEQ_FORM_SCROLL_U;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・フォルム切り替え（下）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormScroll_D( ZKN2_WORK * wk )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	u32	i;

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		wk->detail_form_pos++;
		ZKN2OBJ_FormPokeIconMoveInit( wk, -1 );
		ZKN2OBJ_AnmSet( wk, ZKN2_OBJ_FORM_ARROW_D, ZKN2OBJ_M_ANM_DOWN_TOUCH );
		ZKN2BMP_FormNameMoveInit( wk, -1 );
		for( i=0; i<6; i++ ){
			BGWINFRM_MoveInit( wk->wfrm, ZKN2_BGWF_DETAIL_LIST1+i, 0, -1, 3 );
		}
		swk->bar_my = ZKN2OBJ_DetailListBarAotoMoveCntGet(
						wk,
						ZKN2_OBJ_FORM_BAR,
						ZKN2OBJ_FormListBarPosYGet(wk,wk->detail_form_pos),
						3 );
		swk->seq++;
	case 1:
		ZKN2OBJ_FormPokeIconMove( wk, -8 );
		ZKN2OBJ_DetailListBarAotoMove( wk, ZKN2_OBJ_FORM_BAR, swk->bar_my );
		swk->cnt++;
		if( swk->cnt == 3 ){
			swk->seq = 0;
			swk->cnt = 0;
			swk->mv--;
			if( swk->mv == 0 ){
				ZKN2OBJ_FormPage1PokeGraChange( wk, wk->detail_form_pos );
				ZKN2OBJ_FormListBarPosYSet( wk );
				ZKN2OBJ_DetailListArrowAnmChange(
					wk, wk->detail_form_pos, wk->detail_form_max, ZKN2_OBJ_FORM_ARROW_U );
				ZKN2BMP_FormNamePutU1( wk );
				MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
				return ZKN2SEQ_MAINSEQ_FORM_MAIN;
			}
		}
	}

	return ZKN2SEQ_MAINSEQ_FORM_SCROLL_D;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・フォルム切り替え（バー）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormScroll_Bar( ZKN2_WORK * wk )
{
	u32	x, y;

	if( GF_TP_GetPointCont( &x, &y ) == FALSE ){
		return ZKN2SEQ_MAINSEQ_FORM_MAIN;
	}

	if( ZKN2OBJ_FormListBarMove( wk, x, y ) == TRUE ){
		ZKN2OBJ_FormPage1PokeIconInit( wk );
		ZKN2OBJ_FormPage1PokeGraChange( wk, wk->detail_form_pos );
		ZKN2OBJ_DetailListArrowAnmChange(
			wk, wk->detail_form_pos, wk->detail_form_max, ZKN2_OBJ_FORM_ARROW_U );
		ZKN2BMP_FormListNamePutInit( wk );
		ZKN2BMP_FormNamePutU1( wk );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
	}

	return ZKN2SEQ_MAINSEQ_FORM_SCROLL_BAR;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面・フォルム切り替え（レール）
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_FormScroll_Rail( ZKN2_WORK * wk )
{
	LISTRAIL_SCROLL_WORK * swk = (LISTRAIL_SCROLL_WORK *)wk->seq_work;

	if( ZKN2OBJ_FormListBarMove( wk, swk->x, swk->y ) == TRUE ){
		ZKN2OBJ_FormPage1PokeIconInit( wk );
		ZKN2OBJ_FormPage1PokeGraChange( wk, wk->detail_form_pos );
		ZKN2OBJ_DetailListArrowAnmChange(
			wk, wk->detail_form_pos, wk->detail_form_max, ZKN2_OBJ_FORM_ARROW_U );
		ZKN2BMP_FormListNamePutInit( wk );
		ZKN2BMP_FormNamePutU1( wk );
		Snd_SePlay( SE_ZKN2_SCROLL_BAR );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
	}

	return ZKN2SEQ_MAINSEQ_FORM_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面２・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Form2Init( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		ZKN2OBJ_Vanish( wk, ZKN2_OBJ_DETAIL_CURSOR, FALSE );
		ZKN2MAIN_DetailButtonOutStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_FORM2_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_DETAIL ) == 0 ){
			wk->detail_form2_cursor = 0;
			wk->detail_form_dir = 0;
			wk->detail_form_pos2 = 0;
			if( wk->detail_form_pos == wk->detail_form_pos2 ){
				Form2PosChange( &wk->detail_form_pos2, wk->detail_form_pos, 1, wk->detail_form_max );
			}
			ZKN2MAIN_Form2BgLoad( wk );
			ZKN2BMP_Form2PageBmpPut( wk );
			ZKN2OBJ_Form1PageObjOff( wk );
			ZKN2OBJ_Form2PageObjPut( wk );
			PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, 0, 16, 0, 0 );
			PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, 0, 16, 0, 0 );
			PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
			wk->seq_work[0] = 0;
			wk->next_seq = ZKN2SEQ_MAINSEQ_FORM2_MAIN;
			return ZKN2SEQ_MAINSEQ_PALETTE_FADE;
		}
	}

	return ZKN2SEQ_MAINSEQ_FORM2_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面２・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Form2Main( ZKN2_WORK * wk )
{
	BOOL touch;

	switch( ZKN2UI_DetailForm2Main( wk, &touch ) ){
	case ZKN2UI_FORM2_POKE_LU:	// 左ポケモン上矢印
		if( Form2PokeIconChangeL( wk, -1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
		}
		break;

	case ZKN2UI_FORM2_POKE_LD:	// 左ポケモン下矢印
		if( Form2PokeIconChangeL( wk, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
		}
		break;

	case ZKN2UI_FORM2_POKE_RU:	// 右ポケモン上矢印
		if( Form2PokeIconChangeR( wk, -1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
		}
		break;

	case ZKN2UI_FORM2_POKE_RD:	// 右ポケモン下矢印
		if( Form2PokeIconChangeR( wk, 1 ) == TRUE ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
		}
		break;

	case ZKN2UI_FORM2_CHANGE:	// 切り替え
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_DECIDE );
		}
		wk->detail_form_dir ^= 1;
		ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA1, wk->detail_form_pos );
		ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA2, wk->detail_form_pos2 );
		return FormButtonAnmPut( wk, ZKN2_BGF_UNDER_M, 1, 20, 14, 3, ZKN2SEQ_MAINSEQ_FORM2_MAIN );

	case ZKN2UI_FORM2_CANCEL:	// 戻る
		Snd_SePlay( SE_ZKN2_CANCEL );
		return FormButtonAnmPut( wk, ZKN2_BGF_UNDER_M, 16, 20, 15, 3, ZKN2SEQ_MAINSEQ_FORM2_END );

	case ZKN2UI_FORM2_MOVE_L:	// カーソル左移動
		if( wk->detail_form_max >= 3 && wk->detail_form2_cursor != 0 ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			wk->detail_form2_cursor = 0;
			ZKN2OBJ_Form2CursorPut( wk );
		}
		break;

	case ZKN2UI_FORM2_MOVE_R:	// カーソル右移動
		if( wk->detail_form_max >= 3 && wk->detail_form2_cursor != 1 ){
			if( touch == TRUE ){
				Snd_SePlay( SE_ZKN2_BUTTON );
			}else{
				Snd_SePlay( SE_ZKN2_SELECT );
			}
			wk->detail_form2_cursor = 1;
			ZKN2OBJ_Form2CursorPut( wk );
		}
		break;
	}

	return ZKN2SEQ_MAINSEQ_FORM2_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：姿画面２・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_Form2End( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, 0, 0, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, 0, 0, 16, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_FORM2_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		ZKN2OBJ_Form2PageObjOff( wk );
		ZKN2BMP_Form2PageBmpOff( wk );
		ZKN2MAIN_FormPageBgLoad( wk );
		ZKN2OBJ_Form1PageObjPut( wk );
		ZKN2BMP_Form1PageBmpPut( wk );
		ZKN2MAIN_DetailButtonInStart( wk );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, 0, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, 0, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_FORM2_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 2:
		if( BGWINFRM_MoveCheck( wk->wfrm, ZKN2_BGWF_BTN_DETAIL ) == 0 ){
			ZKN2OBJ_Vanish( wk, ZKN2_OBJ_DETAIL_CURSOR, TRUE );
			wk->seq_work[0] = 0;
			return ZKN2SEQ_MAINSEQ_FORM_MAIN;
		}
	}

	return ZKN2SEQ_MAINSEQ_FORM2_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：戻る画面・初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_DetailRetInit( ZKN2_WORK * wk )
{
	switch( wk->seq_work[0] ){
	case 0:
//		ZKN2BMP_FormPageBGWFSet( wk );
//		ZKN2OBJ_DetailCursorPut( wk, 3 );
		ZKN2MAIN_PageInit( wk, ZKN_PAGE_RETURN );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, 16, 0, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, 16, 0, 0 );
		wk->seq_work[0]++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_DETAIL_RET_INIT;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		wk->page = ZKN_PAGE_RETURN;
		wk->seq_work[0] = 0;
		return ZKN2SEQ_MAINSEQ_DETAIL_RET_MAIN;
	}

	return ZKN2SEQ_MAINSEQ_DETAIL_RET_INIT;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：戻る画面・メイン
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_DetailRetMain( ZKN2_WORK * wk )
{
	BOOL touch;

	switch( ZKN2UI_DetailRetMain( wk, &touch ) ){
	case ZKN2UI_DETAIL_ENCOUNT_BTN:	//「ぶんぷ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_PLACE );

	case ZKN2UI_DETAIL_SIZE_BTN:	//「おおきさ」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_SIZE );

	case ZKN2UI_DETAIL_FORM_BTN:	//「すがた」
		if( touch == TRUE ){
			Snd_SePlay( SE_ZKN2_BUTTON );
		}else{
			Snd_SePlay( SE_ZKN2_SELECT );
		}
		return DeteilEndSet( wk, 0, ZKN_PAGE_FORM );

	case ZKN2UI_DETAIL_RET_BTN:		//「もどる」
		Snd_SePlay( SE_ZKN2_CANCEL );
		return DeteilEndSet( wk, 0, 0xff );

	case ZKN2UI_DETAILRET_A:		// Ａもどる
		Snd_SePlay( SE_ZKN2_CANCEL );
		return FormButtonAnmPut( wk, ZKN2_BGF_UNDER_M, 6, 9, 20, 4, ZKN2SEQ_MAINSEQ_DETAIL_END );
	}

	return ZKN2SEQ_MAINSEQ_DETAIL_RET_MAIN;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：戻る画面・終了
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_DetailRetEnd( ZKN2_WORK * wk )
{
	DETAIL_END_WORK * swk = (DETAIL_END_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_BG, 0xf7be, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_MAIN_OBJ, 0xffef, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		PaletteFadeReq( wk->pfd, PF_BIT_SUB_ALL, 0xffff, DETAIL_FADE_SPEED, swk->start, 16, 0 );
		swk->seq++;
		wk->next_seq = ZKN2SEQ_MAINSEQ_DETAIL_RET_END;
		return ZKN2SEQ_MAINSEQ_PALETTE_FADE;

	case 1:
		ZKN2BMP_DetailRetPageExit( wk );
		MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
		if( wk->page == ZKN_PAGE_SIZE ){
			return ZKN2SEQ_MAINSEQ_SIZE_INIT;
		}else if( wk->page == ZKN_PAGE_FORM ){
			return ZKN2SEQ_MAINSEQ_FORM_INIT;
		}
		return ZKN2SEQ_MAINSEQ_ENCOUNT_INIT;
	}

	return ZKN2SEQ_MAINSEQ_DETAIL_RET_END;
}

//--------------------------------------------------------------------------------------------
/**
 * メインシーケンス：終了設定
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int MainSeq_EndSet( ZKN2_WORK * wk )
{
	wk->next_seq = ZKN2SEQ_MAINSEQ_END;
	return FadeOutSet( wk, ZKN2SEQ_MAINSEQ_RELEASE );
}


//============================================================================================
//	シーケンス切り替え関連
//============================================================================================

//--------------------------------------------------------------------------------------------
/**
 * フェードイン設定（ワイプ使用）
 *
 * @param	wk		図鑑画面ワーク
 * @param	next	フェード後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int FadeInSet( ZKN2_WORK * wk, int next )
{
	APP_WipeStart( APP_WIPE_IN, HEAPID_ZUKAN );

	wk->wipe_seq = next;

	return ZKN2SEQ_MAINSEQ_WIPE;
}

//--------------------------------------------------------------------------------------------
/**
 * フェードアウト設定（ワイプ使用）
 *
 * @param	wk		図鑑画面ワーク
 * @param	next	フェード後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int FadeOutSet( ZKN2_WORK * wk, int next )
{
	WIPE_SYS_Start(
		WIPE_PATTERN_WMS, WIPE_TYPE_FADEOUT, WIPE_TYPE_FADEOUT,
		WIPE_FADE_BLACK, WIPE_DEF_DIV, WIPE_DEF_SYNC, HEAPID_ZUKAN );

//	APP_WipeStart( APP_WIPE_OUT, HEAPID_ZUKAN );

	wk->wipe_seq = next;

	return ZKN2SEQ_MAINSEQ_WIPE;
}

//--------------------------------------------------------------------------------------------
/**
 * ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	frm		ＢＧフレーム
 * @param	px		Ｘ座標
 * @param	py		Ｙ座標
 * @param	sx		Ｘサイズ
 * @param	sy		Ｙサイズ
 * @param	n_pal	通常のパレット
 * @param	p_pal	押した時のパレット
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int ButtonAnmSet(
			ZKN2_WORK * wk, u8 frm, u8 px, u8 py, u8 sx, u8 sy, u8 n_pal, u8 p_pal, int next )
{
	BUTTON_ANM_WORK * swk = (BUTTON_ANM_WORK *)wk->seq_work;
	swk->px  = px;
	swk->py  = py;
	swk->sx  = sx;
	swk->sy  = sy;
	swk->frm = frm;
	swk->seq = 0;
	swk->cnt = 0;
	swk->n_pal = n_pal;
	swk->p_pal = p_pal;
	wk->next_seq = next;
	return ZKN2SEQ_MAINSEQ_BUTTON_ANM;
}

//--------------------------------------------------------------------------------------------
/**
 * トップ・リスト画面用ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	px		Ｘ座標
 * @param	sx		Ｘサイズ
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int ListButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 sx, int next )
{
	return ButtonAnmSet( wk, ZKN2_BGF_CENTER_M, px, 19, sx, 5, 0, 6, next );
}

//--------------------------------------------------------------------------------------------
/**
 * 検索画面メインページ用ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	px		Ｘ座標
 * @param	sx		Ｘサイズ
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int SearchMainButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 sx, int next )
{
	return ButtonAnmSet( wk, ZKN2_BGF_UPPER_M, px, 20, sx, 4, 4, 5, next );
}

//--------------------------------------------------------------------------------------------
/**
 * 検索画面入力ページ用ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	px		Ｘ座標
 * @param	py		Ｙ座標
 * @param	sx		Ｘサイズ
 * @param	sy		Ｙサイズ
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int SearchInputButtonAnmSet( ZKN2_WORK * wk, u8 px, u8 py, u8 sx, u8 sy, int next )
{
	return ButtonAnmSet( wk, ZKN2_BGF_CENTER_M, px, py, sx, sy, 2, 3, next );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面用ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	px		Ｘ座標
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int DetailButtonAnmPut( ZKN2_WORK * wk, u8 px, int next )
{
	return ButtonAnmSet( wk, ZKN2_BGF_UPPER_M, px, 20, 8, 4, 0, 6, next );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面姿ページ用ボタンアニメ設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	frm		ＢＧフレーム
 * @param	px		Ｘ座標
 * @param	py		Ｙ座標
 * @param	sx		Ｘサイズ
 * @param	sy		Ｙサイズ
 * @param	next	アニメ後に遷移するシーケンス
 *
 * @return	次のシーケンス
 */
//--------------------------------------------------------------------------------------------
static int FormButtonAnmPut( ZKN2_WORK * wk, u8 frm, u8 px, u8 py, u8 sx, u8 sy, int next )
{
	return ButtonAnmSet( wk, frm, px, py, sx, sy, 10, 11, next );
}


//============================================================================================
//	その他
//============================================================================================

//--------------------------------------------------------------------------------------------
/**
 * 図鑑モード切り替え
 *
 * @param	wk		図鑑画面ワーク
 * @param	mode	図鑑モード
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void ZukanModeChange( ZKN2_WORK * wk, u32 mode )
{
	ZUKANPARAM_Set( wk->dat->zkn_param, ZKN2LIST_SelMonsGet(wk), wk->zkn_mode );

	wk->zkn_mode = mode;

	ZKN2MAIN_ZukanNamePut( wk );
	ZKN2OBJ_CoverSwithPut( wk, ZKN2_OBJ_SWITCH );

	ZKN2LIST_MonsListTblMake(
		wk, wk->zkn_mode,
		ZKN2LIST_SORT_NORMAL,			// ポケモンナンバー
		ZKN2LIST_SEARCH_NAME_NONE,		// 名前
		ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
		ZKN2LIST_SEARCH_TYPE_NONE,		// タイプ
		0,								// 高さ（低）
		ZKN2_HW_DOT_MAX,				// 高さ（高）
		0,								// 重さ（低）
		ZKN2_HW_DOT_MAX,				// 重さ（高）
		ZKN2LIST_SEARCH_AREA_MASK_NONE,	// 地域
		ZKN2LIST_SEARCH_FORM_NONE );	// 形

	ZKN2BMP_CoverNumPrint( wk );
}

//--------------------------------------------------------------------------------------------
/**
 * 図鑑モードに対応したリストを再設定
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void ZukanModeRemakeList( ZKN2_WORK * wk )
{
	u32	pos;
	u16	mons;

	DefaultListPosSet( wk );

	ZKN2LIST_ListPutMake( wk, TRUE );

	mons = ZKN2LIST_SelMonsGet( wk );
	pos  = ZKN2LIST_SelPosGet( wk );

	if( ZKN2MAIN_LangCheck( wk, mons, wk->lang ) == FALSE ){
		wk->lang = PM_LANG;
	}

	ZKN2BMP_ListPokeInfoPut( wk, mons, pos );
	ZKN2BMP_ListPokeTextPut( wk, mons, pos );

	ZKN2OBJ_PokeIconListInit( wk, ZKN2_OBJ_POKEICON );
	ZKN2OBJ_PokeGraChange( wk, mons, ZKN2_OBJ_POKEGRA1, ZKN2_OBJ_NAZOPOKE_S );
	ZKN2OBJ_TypeIconAnmChg( wk, mons, pos, ZKN2_OBJ_TYPEICON1 );
	ZKN2OBJ_ListSubLangIconChg( wk, mons, ZKN2_OBJ_LANGICON1 );
	ZKN2OBJ_PokeFootChange( wk, mons, pos, ZKN2_OBJ_POKEFOOT );
	ZKN2OBJ_ListCursorMove( wk, ZKN2_OBJ_CURSOR );
	ZKN2OBJ_ListArrowAnmChange( wk, ZKN2_OBJ_ARROW_U, TRUE );
	ZKN2OBJ_ListBarAnmChg( wk, ZKN2_OBJ_BAR, TRUE );
	ZKN2OBJ_ListBarPosYSet( wk, ZKN2_OBJ_BAR, TRUE );

	ZKN2MAIN_PokeInfoBgPut( wk->bgl, ZKN2_BGF_UNDER_S, wk->lang, wk->graphic_ah, HEAPID_ZUKAN );
	ZKN2MAIN_ListBgSet( wk );
}

//--------------------------------------------------------------------------------------------
/**
 * 図鑑モードセット
 *
 * @param	wk		図鑑画面ワーク
 * @param	mode	図鑑モード
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void ZukanModeSet( ZKN2_WORK * wk, u32 mode )
{
	ZukanModeChange( wk, mode );
	ZukanModeRemakeList( wk );
}

//--------------------------------------------------------------------------------------------
/**
 * リスト位置取得
 *
 * @param	wk		図鑑画面ワーク
 * @param	mode	図鑑モード
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void DefaultListPosSet( ZKN2_WORK * wk )
{
	u32	mons;

	mons = ZUKANPARAM_ListPosGet( wk->dat->zkn_param );
	mons = ZKN2LIST_StartMonsCheck( &wk->mons_list, mons );
//	OS_Printf( "def_mons = %d\n", mons );
	mons = PMNumber_GetPokeNumber( wk->zkn_mode, mons ) - 1;	// ０オリジンにする

	wk->list_pos = mons % ZKN2_POKEICON_SEL_MAX;
	wk->list_scr = mons / ZKN2_POKEICON_SEL_MAX;
}

//--------------------------------------------------------------------------------------------
/**
 * 鳴き声再生
 *
 * @param	wk		図鑑画面ワーク
 *
 * @retval	"TRUE = 再生"
 * @retval	"FALSE = その他"
 */
//--------------------------------------------------------------------------------------------
static BOOL PokeVoicePlay( ZKN2_WORK * wk )
{
	u32	frm;
	u16	mons;

	mons = ZKN2LIST_SelMonsGet( wk );

	if( mons == 0 ){ return FALSE; }

	frm = ZukanWork_GetPokeForm( wk->dat->zukan_work,mons, 0 );
	if( mons == MONSNO_PITYUU ){
		if( frm == 2 ){
			frm = 1;
		}else{
			frm = 0;
		}
	}

	Snd_PerapVoiceDefaultFlagSet( TRUE );	// ぺラップのデフォルトの鳴き声を再生するフラグON
	Snd_PMVoicePlay( mons, frm );
	Snd_PerapVoiceDefaultFlagSet( FALSE );	// ぺラップのデフォルトの鳴き声を再生するフラグOFF
	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 検索画面ページ移行ワーク設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	init	初期化ページ
 * @param	pos		初期カーソル位置
 * @param	next	初期化後に移行するシーケンス
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void SearchInputWorkSet( ZKN2_WORK * wk, u32 init, u32 pos, u32 next )
{
	SEARCH_INPUT_INIT_WORK * swk = (SEARCH_INPUT_INIT_WORK *)wk->seq_work;

	swk->init = init;
	swk->next = next;
	swk->pos  = pos;
	swk->seq  = 0;
}

//--------------------------------------------------------------------------------------------
/**
 * リスト画面ボタンON/OFF切り替え
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void ListButtonOnOffSet( ZKN2_WORK * wk )
{
	u8	pal;

	if( ZKN2LIST_SelMonsGet( wk ) == 0 ){
		pal = 11;
	}else{
		pal = 0;
	}
	BGWINFRM_PaletteChange( wk->wfrm, ZKN2_BGWF_BTN_LIST, 8, 0, 16, 5, pal );
	GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_CENTER_M, 8, 19, 16, 5, pal );
	GF_BGL_LoadScreenV_Req( wk->bgl, ZKN2_BGF_CENTER_M );
}

//--------------------------------------------------------------------------------------------
/**
 * 検索結果リスト画面ボタンON/OFF切り替え
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void SearchListButtonOnOffSet( ZKN2_WORK * wk )
{
	u8	pal;

	if( ( wk->list_pos == 0 && wk->list_scr == 0 ) || ZKN2LIST_SelMonsGet( wk ) == 0 ){
		pal = 11;
	}else{
		pal = 0;
	}
	BGWINFRM_PaletteChange( wk->wfrm, ZKN2_BGWF_BTN_SEARCH_LIST, 8, 0, 16, 5, pal );
	GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_CENTER_M, 8, 19, 16, 5, pal );
	GF_BGL_LoadScreenV_Req( wk->bgl, ZKN2_BGF_CENTER_M );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面フォルムリストスクロール設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	mv		移動値
 * @param	cnt		スクロール数
 *
 * @retval	"TRUE = スクロール可"
 * @retval	"FALSE = スクロール不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL FormListScrollSet( ZKN2_WORK * wk, s8 mv, u8 cnt )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	s32	pos;

	pos = wk->detail_form_pos + mv;

	if( pos < 0 || pos >= wk->detail_form_max ){
		return FALSE;
	}

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	swk->seq = 0;
	swk->cnt = 0;
	swk->mv  = cnt;

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面姿ページ２ 切り替えフォルム取得
 *
 * @param	p1		切り替えるフォルム位置
 * @param	p2		比較対象のフォルム位置
 * @param	mv		切り替え方向
 * @param	max		フォルム数
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void Form2PosChange( s8 * p1, s8 p2, s8 mv, u8 max )
{
	u32	i;

	for( i=0; i<max; i++ ){
		*p1 += mv;
		if( *p1 < 0 ){
			*p1 = max - 1;
		}else if( *p1 >= max ){
			*p1 = 0;
		}
		if( *p1 != p2 ){
			break;
		}
	}
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面姿ページ２ 左のフォルム切り替え
 *
 * @param	wk		図鑑画面ワーク
 * @param	mv		切り替え方向
 *
 * @retval	"TRUE = 切り替え可"
 * @retval	"FALSE = 切り替え不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL Form2PokeIconChangeL( ZKN2_WORK * wk, s8 mv )
{
	s8	cpy;

	if( wk->detail_form_max < 3 ){ return FALSE; }

	wk->detail_form2_cursor = 0;
	ZKN2OBJ_Form2CursorPut( wk );

	cpy = wk->detail_form_pos;

	Form2PosChange( &wk->detail_form_pos, wk->detail_form_pos2, mv, wk->detail_form_max );

	if( wk->detail_form_pos == cpy ){ return FALSE; }

	ZKN2OBJ_Form2PagePokeIconChange( wk, ZKN2_OBJ_FORM_POKEICON1, wk->detail_form_pos );
	ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA1, wk->detail_form_pos );
	ZKN2BMP_Form2FormNamePut( wk, ZKN2_BMPWIN_FORM_D_FORM_L, wk->detail_form_pos );

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面姿ページ２ 右のフォルム切り替え
 *
 * @param	wk		図鑑画面ワーク
 * @param	mv		切り替え方向
 *
 * @retval	"TRUE = 切り替え可"
 * @retval	"FALSE = 切り替え不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL Form2PokeIconChangeR( ZKN2_WORK * wk, s8 mv )
{
	s8	cpy;

	if( wk->detail_form_max < 3 ){ return FALSE; }

	wk->detail_form2_cursor = 1;
	ZKN2OBJ_Form2CursorPut( wk );

	cpy = wk->detail_form_pos2;

	Form2PosChange( &wk->detail_form_pos2, wk->detail_form_pos, mv, wk->detail_form_max );

	if( wk->detail_form_pos2 == cpy ){ return FALSE; }

	ZKN2OBJ_Form2PagePokeIconChange( wk, ZKN2_OBJ_FORM_POKEICON2, wk->detail_form_pos2 );
	ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA2, wk->detail_form_pos2 );
	ZKN2BMP_Form2FormNamePut( wk, ZKN2_BMPWIN_FORM_D_FORM_R, wk->detail_form_pos2 );

	return TRUE;
}

// ※未使用
static void Form2PokeGraChange( ZKN2_WORK * wk )
{
	if( wk->detail_form2_cursor == 0 ){
		ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA1, wk->detail_form_pos );
	}else{
		ZKN2OBJ_Form2PagePokeGraChange( wk, ZKN2_OBJ_FORM_POKEGRA2, wk->detail_form_pos2 );
	}
}



// 重さ比べ演出用ワーク
typedef struct {
	u32	seq;
	ZKN2OBJ_WEIGHT_ANM_WORK * anmwk;
}WEIGHT_ANM_WORK;

//--------------------------------------------------------------------------------------------
/**
 * 重さ比べアニメ
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void WeightAnime( ZKN2_WORK * wk )
{
	WEIGHT_ANM_WORK * swk = (WEIGHT_ANM_WORK *)wk->seq_work;

	switch( swk->seq ){
	case 0:
		swk->anmwk = sys_AllocMemory( HEAPID_ZUKAN, sizeof(ZKN2OBJ_WEIGHT_ANM_WORK) );
		ZKN2OBJ_WeightAnmWorkInit( wk, swk->anmwk );
		Snd_SePlay( SE_ZKN2_FALL );
		swk->seq++;

	case 1:
		if( ZKN2OBJ_WeightAnmFall( swk->anmwk ) == FALSE ){
			swk->seq++;
		}
		break;

	case 2:
		if( ZKN2OBJ_WeightAnmMain( swk->anmwk ) == FALSE ){
			swk->seq++;
		}
		break;

	default:
		break;
	}
}

//--------------------------------------------------------------------------------------------
/**
 * 重さ比べアニメワーク解放
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void WeightAnimeWorkFree( ZKN2_WORK * wk )
{
	WEIGHT_ANM_WORK * swk = (WEIGHT_ANM_WORK *)wk->seq_work;

	sys_FreeMemoryEz( swk->anmwk );
	MI_CpuClear8( wk->seq_work, ZKN2_SEQ_WORK_SIZ );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布リストスクロール設定
 *
 * @param	wk		図鑑画面ワーク
 * @param	mv		移動値
 * @param	cnt		スクロール数
 *
 * @retval	"TRUE = スクロール可"
 * @retval	"FALSE = スクロール不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL PlaceListScrollSet( ZKN2_WORK * wk, s8 mv, u8 cnt )
{
	DETAIL_LIST_SCROLL_WORK * swk;
	s32	pos;

	pos = wk->detail_place_pos + mv;

	if( pos < 0 || pos >= wk->enc_data.all.num ){
		return FALSE;
	}

	swk = (DETAIL_LIST_SCROLL_WORK *)wk->seq_work;

	swk->seq = 0;
	swk->cnt = 0;
	swk->mv  = cnt;

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布時間帯切り替え
 *
 * @param	wk		図鑑画面ワーク
 * @param	time	時間帯
 *
 * @retval	"TRUE = 切り替え可"
 * @retval	"FALSE = 切り替え不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL EncountTimeChange( ZKN2_WORK * wk, s8 time )
{
	if( wk->detail_place_time == time ){
		return FALSE;
	}
	wk->detail_place_time = time;
	wk->detail_place_pos  = 0;

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布地域切り替え
 *
 * @param	wk		図鑑画面ワーク
 * @param	mode	地域
 *
 * @retval	"TRUE = 切り替え可"
 * @retval	"FALSE = 切り替え不可"
 */
//--------------------------------------------------------------------------------------------
static BOOL EncountModeChange( ZKN2_WORK * wk, s8 mode )
{
	if( wk->zenkoku_mode == FALSE ){
		return FALSE;
	}

	if( wk->detail_place_mode == mode ){
		return FALSE;
	}

	wk->detail_place_mode = mode;
	wk->detail_place_pos  = 0;

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布地域ボタン変更
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void EncountModeSwitchChg( ZKN2_WORK * wk )
{
	if( wk->zenkoku_mode == FALSE ){ return; }

	if( wk->detail_place_mode == 0 ){
		GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_COVER_M, 9, 1, 7, 2, 12 );
		GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_COVER_M, 24, 1, 7, 2, 10 );
	}else{
		GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_COVER_M, 9, 1, 7, 2, 10 );
		GF_BGL_ScrPalChange( wk->bgl, ZKN2_BGF_COVER_M, 24, 1, 7, 2, 12 );
	}
	GF_BGL_LoadScreenV_Req( wk->bgl, ZKN2_BGF_COVER_M );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布マップ表示ＢＧをジョウトの位置にスクロール
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void EncountMapScrollInit( ZKN2_WORK * wk )
{
	GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, ENC_MAP_SCROLL_X_JOHTO );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布マップ表示ＢＧのスクロールを初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void EncountMapScrollDelete( ZKN2_WORK * wk )
{
	GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_SET, 0 );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布マップ表示ＢＧをスクロール
 *
 * @param	wk		図鑑画面ワーク
 *
 * @retval	"TRUE = スクロール中"
 * @retval	"FALSE = それ以外"
 */
//--------------------------------------------------------------------------------------------
static BOOL EncountMapScroll( ZKN2_WORK * wk )
{
	if( wk->detail_place_mode == 0 ){
		if( GF_BGL_ScreenScrollXGet( wk->bgl, ZKN2_BGF_COVER_S ) == ENC_MAP_SCROLL_X_JOHTO ){
			return FALSE;
		}
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_DEC, ENC_MAP_SCROLL_SPEED );
	}else{
		if( GF_BGL_ScreenScrollXGet( wk->bgl, ZKN2_BGF_COVER_S ) == ENC_MAP_SCROLL_X_KANTO ){
			return FALSE;
		}
		GF_BGL_ScrollReq( wk->bgl, ZKN2_BGF_COVER_S, GF_BGL_SCROLL_X_INC, ENC_MAP_SCROLL_SPEED );
	}

	return TRUE;
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布位置ＯＢＪの半透明アニメ処理
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void EncountPosAlpha( ZKN2_WORK * wk )
{
	switch( wk->detail_place_put_switch ){
	case 0:
		wk->detail_place_alpha++;
		if( wk->detail_place_alpha == 15 ){
			wk->detail_place_put_switch = 1;
		}
		break;

	case 1:
		wk->detail_place_alpha--;
		if( wk->detail_place_alpha == 0 ){
			wk->detail_place_put_switch = 0;
			wk->detail_place_put_flg ^= 1;
			ZKN2OBJ_PlacePosOnOffChange( wk );
		}
		break;
	}
	G2S_SetBlendAlpha(
		GX_BLEND_PLANEMASK_NONE, GX_BLEND_PLANEMASK_BG0,
		(wk->detail_place_alpha), 31-(wk->detail_place_alpha) );
}

//--------------------------------------------------------------------------------------------
/**
 * 詳細画面分布位置ＯＢＪの半透明アニメ初期化
 *
 * @param	wk		図鑑画面ワーク
 *
 * @return	none
 */
//--------------------------------------------------------------------------------------------
static void EncountPosAlphaInit( ZKN2_WORK * wk )
{
	wk->detail_place_put_switch = 0;
	wk->detail_place_alpha = 0;
	wk->detail_place_put_flg = 0;
	ZKN2OBJ_PlacePosOnOffChange( wk );

	G2S_SetBlendAlpha(
		GX_BLEND_PLANEMASK_NONE, GX_BLEND_PLANEMASK_BG0,
		(wk->detail_place_alpha), 31-(wk->detail_place_alpha) );
}